Quantcast
Channel: Active questions tagged worksheet-function - Super User
Viewing all articles
Browse latest Browse all 987

ATAN2 in Excel doesn't work with references

$
0
0

I tried to convert a pair of columns for x-values and y-values into two columns for radii and angles.For the radii I could write =SQRT($x^2 + $x^2), but for =ATAN2($x,$y) I get complaints about invalid signs in the formula.
I have also tried =ATAN($y/$x); that works, so the number of arguments seems to make the difference but doesn't explain the reason for the difference.

So besides an explanation for that quirk I would appreciate suggestions for solutions or workarounds.

Edit:
A workaround is =ATAN($y/$x)+($x<0)*(PI()*(($y>=0)-($y<0)))

Explanation: comparison evaluate to numeric values 0 or 1, which allows one to combine conditons into numerical expression and thus implement the piecewise formula for Atan2 in a single formula


Viewing all articles
Browse latest Browse all 987

Trending Articles