Trigonometry in Excel

S

Serge

A51=25.0
B51=21.5407
C51=42.03 Degrees
In E51
=IF(OR(A51="",B51="",C51=""),0,DEGREES(ATAN(A51*SIN(RADIANS(C51))/(B51-A51*COS(RADIANS(C51))))))
The answer is 79.935 Degrees
The formula above works well because the result is less than 90 Degrees
But in the next scenario:
A51=76.673
B51=47.214
C51=9.50 Degrees
I get -24.01 Degrees The answer should be 155.99 Degrees.

Can someone help with this one.
Many Thanks in advance.
Serge
 
J

Jerry W. Lewis

Excel's trig functions work in radians, not degrees. See Help for the
DEGREES() and RADIANS() functions.

Jerry
 
D

David Biddulph

Excel's trig functions work in radians, not degrees. See Help for the
DEGREES() and RADIANS() functions.

He's dealt with the conversion between degrees and radians, Jerry.

The problem is that ATAN returns an angle in the range -pi/2 to +pi/2
radians, not between 0 and +pi, so if we want a positive angle we need to
use
=IF(OR(A51="",B51="",C51=""),0,MOD(DEGREES(ATAN(A51*SIN(RADIANS(C51))/(B51-A51*COS(RADIANS(C51))))),180))
 
S

Serge

Hello Jerry,
Thanks for your promt reply.
I agree with you. But in the formula shown, the end result is given in
Degrees which is what I want. In first exemple the included angle happens to
be less than 90 degrees.
In the second exemple the result for the included angle is grater than 90
degrees.
 
S

Serge

Hello David,
Thanks for your promt reply.
Will this revision work both ways (less than and great than 90 degrees)?
Serge
 
S

Serge

Hello David,

Fantastic, your'e a genious.
Thank you very much. It works both ways.
Serge
 
S

SiC

Hi Serge,

There's nothing wrong with your formula. You used DEGREES() and RADIANS()
correctly. However, the limit for the ATAN function is from -90 to 90
degrees. Both DEGREES(ATAN(TAN(RADIANS(-24.01)))) and
DEGREES(ATAN(TAN(RADIANS(-155.99)))) will give you -24.01. That's just the
nature of the function. If you have to distinguish between -24.01 and
155.99, you just need to some adjustment in your formula. Basically you just
need to check if the value of (B51-A51*COS(RADIANS(C51))) is negative or not.
If it is negative, add 180 degrees to your answer. I trust that you can
figure out that part yourself. Good luck.

-Simon
 
S

Serge

Hello Simon,
Thank you for your reply.
Your explanation is very appreciated.
I understand better now.
Thank you very much.
Serge
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top