SOLVED

IFS formula

New Contributor
Hi,
I'm trying to calculate the angle clockwise from the positive Y axis from two points stored an columns A and B. These values can be positive or negative.
I'm using the formula
ATAN(A1/B1) *180/PI()
to calculate the angle in degrees but running foul of the obvious problems with the 4 quadrants
I know that if
A+ and B+ then do nothing
A+ and B- then add 180
A- and B- then add 180
A- and B+ then add 360

For example
A B C
2 2 Is 45
2 -2 is 135
-2 - 2 is 225
-2 2 is 315

what I can't work out is the syntax of the IFS statement in say C1 to show the angle?

There may be an easier way of doing this but I'm new to excel and this is the only way I know to get the answer I require?

Cheers.
3 Replies
best response confirmed by JimMac (New Contributor)
Solution
=ATAN(A1/B1)*180/PI() + IFS(B1<0,180,A1<0,360,TRUE,0)
Thanks for the swift and consise reply. My less than logical mind was taking me down a horribly complicated and convoluted jumble.

Happy New Year,

Jim

@JimMac 

As variant

=180*(ATAN2(B1,A1)/PI() + 2*(A1<0) )