I'm trying to solve for $z$ given $x=\dfrac y{2 \tan(z/2)}$.
Wolfram Alpha gives me the solution, but when I plug the formula into Excel it's not giving expected results at all - if I plug the same $x$ value into the formula it does not give me the $z$ that I originally started with.
Hopefully that's enough information to go off of; normally I frequent Stackoverflow. Thanks!
The solution is
$$2 \left(\pi c_1+\cot ^{-1}\left(\frac{2 x}{y}\right)\right)$$
where $c_1$ is an integer.
Doesn't this work for you?