Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default adding subtracting angles/degrees

Hi guys/gals,

I am trying to figure out how to add and subtract two degrees. I am
speaking about compass/directional degrees (or angles if you prefer).

I need to be able to subtract lets say 45 degrees from a heading/angle
of 020 and arrive at the appropriate result. In this case 335.


Also how can I display the result or format the field to display a
leading "zero" ie 020.

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default adding subtracting angles/degrees

Jimmy,

Try the following functions

Function AddDegrees(X As Double, Y As Double) As Double
AddDegrees = (X + Y) Mod 360
End Function
Function SubtractDegrees(X As Double, Y As Double) As Double
SubtractDegrees = (X - Y) - ((X - Y < 0) * 360)
End Function

You can use a custom number format of "000" to preserve the
leading zero.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Jimmy" wrote in message
...
Hi guys/gals,

I am trying to figure out how to add and subtract two degrees. I

am
speaking about compass/directional degrees (or angles if you

prefer).

I need to be able to subtract lets say 45 degrees from a

heading/angle
of 020 and arrive at the appropriate result. In this case 335.


Also how can I display the result or format the field to display

a
leading "zero" ie 020.

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default adding subtracting angles/degrees

On Mon, 11 Aug 2003 20:19:33 GMT, Jimmy wrote:

Hi guys/gals,

I am trying to figure out how to add and subtract two degrees. I am
speaking about compass/directional degrees (or angles if you prefer).

I need to be able to subtract lets say 45 degrees from a heading/angle
of 020 and arrive at the appropriate result. In this case 335.


Also how can I display the result or format the field to display a
leading "zero" ie 020.

Thanks in advance


I think this will work as a worksheet formula:

=MOD(Heading+Change,360)

To subtract, enter Change as a negative number.

=mod(20 + (-45),360) -- 335

Format/Cells/Number/Custom Type: 000
or, if you want to be fancy, 000\°

To insert the degree sign, hold down the <alt key while typing -- on the
NUMERIC KEYPAD -- 0176.


--ron
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default adding subtracting angles/degrees

Thanks Guys,

That is what I was looking for.


Cheers

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i do adding and subtracting on excel Angela New Users to Excel 3 February 2nd 07 09:16 PM
ADDING/SUBTRACTING FROM RIGHT TO LEFT Joanne Excel Worksheet Functions 6 July 28th 06 07:25 PM
How to do I convert angles from radians to degrees in Excel? HELP ME PLEASE!!!!! Excel Worksheet Functions 2 January 13th 06 07:20 PM
How do i convert angles from degrees,minutes, seconds to decimal morne Excel Discussion (Misc queries) 1 November 23rd 05 02:09 PM
HOW DO I CONVERT ANGLES TO DECIMAL DEGREES LTHSATT Excel Worksheet Functions 1 June 7th 05 03:18 AM


All times are GMT +1. The time now is 09:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"