ATAN2 function
Description
Arc tangent of two numbers, or four-quadrant inverse tangent. ATAN2(y,x) returns the arc tangent of the two numbers x and y. It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result.
The result is an angle expressed in radians. To convert from radians to degrees, use the DEGREES function.
In terms of the standard arc tangent function, atan2 can be expressed as follows:
$$ \operatorname{atan2}(y,x) =
\begin{cases}
\arctan(\frac y x) &\text{if } x > 0 \\
\arctan(\frac y x) + \pi &\text{if } x < 0 \text{ and } y \ge 0 \\
\arctan(\frac y x) - \pi &\text{if } x < 0 \text{ and } y < 0 \\
+\frac{\pi}{2} &\text{if } x = 0 \text{ and } y > 0 \\
-\frac{\pi}{2} &\text{if } x = 0 \text{ and } y < 0 \\
\text{undefined} &\text{if } x = 0 \text{ and } y = 0
\end{cases}$$
Note that in Excel the parameters y and x are reversed.