Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add or subtract polar degrees in Excel 1

Status
Not open for further replies.

Ralph2

Industrial
May 3, 2002
345
Can some one please show me how to add or subtract polar degrees in MS Excel (2003).
I have two polar values (anywhere from 0 to 360 degrees), A1=10 A2=359.5 A3=MOD(A1-A2,360)which returns the correct value of 10.5
But.. if A1=350 and A2=359.5 A3=MOD(A1-A2,360) returns 350.5 and not the correct value of 9.5 degrees. Can this be fixed with a pile of "IF" .. THEN" statements.. or there must be a better way

Thank you for your time, it is very much appreciated.
Ralph




 
Replies continue below

Recommended for you

I don't get your second example: 350-359.5 is -9.5-->+350.5, while 10-359.5 = -349.5-->+10.5, so they're both "correct" mathematically

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
Yes.. technically but I would like to display the smaller of the two correct answers.. ie a difference of 20 degrees.
My simple spreadsheet,
A1 350 degrees
A2 10 degrees
A3=MOD(A1-A2,360) which returns 340.. which is correct but I want it to show 20 degrees.
 
So, what answer do you "want" for 351 -> 14? 9+14 = 23 degrees? (Both of their differences from 360) or do you want (351-14) = 337
 
Or am I mis-understanding your 10 -> 350 example? Where you wanted "20"?
 
Thank you racookpe
The solution that MintJulep (Mechanical) gave me is doing exactly what I wanted.
=MIN(MOD(A1-A2,360), 360-MOD(A1-A2,360))
 
Seems like op wants the smallest measure of the angle between two vectors A1 and A2 without keeping track of the "polarity" of the result (polarity might otherwise be expressed as negative/positive, CW/CCW, A1 leads A2 or A2 leads A1).

In most applications (balancing for example), it would be important to track the polarity (sign) that results from vector subtraction. But we don't know his application.


=====================================
(2B)+(2B)' ?
 
Sorry - I introduced vector subtraction which was not particularly implied by original post.

Maybe I should have just said he wants to know the distance between two angles, expressed as an angle less than 180 degrees, without regard for the polarity.


=====================================
(2B)+(2B)' ?
 
electricpete said:
he wants to know ..
Rather, I'm guessing at a word description which was never given in original post but can be inferred from the answer that he liked.

=====================================
(2B)+(2B)' ?
 
Sorry for all the confusion. I was making a spreadsheet that would do all kinds of calculations pertaining to balancing. Calculate various tolerances, force generated by a known unbalance, combine weights to a single location, divide a given weight into two components. And some other trivia. The question that started this was.. if I have a force at say 10 degrees and another at 345 degrees, what is the difference? It could be 25 or 335 degrees. For my application I wanted the smaller (shorter) value of 25.
 
=DEGREES(ASIN(SIN(RADIANS(A1-A2))))

Polarity is maintained. If you want the absolute value, just add that function to the string.

But forces have magnitude as well as direction, so vector subtraction as electricpete suggested may be appropriate.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor