# calculate compass angle from coordinates

#### cutterpg

##### New Member
I'm trying to find the simplest way to convert a trig angle measurement (between 180 and -180 degrees (or pi and -pi radians)) originating from the positive side of the x axis) to a standard compass bearing (between 0 and 360 degrees originating clockwise from the positive y axis).

I can't come up with a formula or algorithm that works with any angle value.

### Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
For limited angle degree inputs of -90 to +360, the following works:

bearing = if(angle<=90,90-Angle,450-Angle)

If you need it for ANY angle input, positive or negative without bound, you'll have to get fancier by using the Modulus function to get rid of multiples of 360, and work with the degrees left over.

HTH

Any decent computer-aided astrologer can talk on this stuff until your eyes glaze over.

A great source for this sort of thing is mathtools.net. Quick search there (for 'degrees') sent me to :

http://www.em-ing.de/home_e.htm

Do it this way:
if X is positive and Y is positive (XY=++), use 90 - theta
if XY = -+, use 270 - theta
if XY = +-, use 90 - theta
if XY = --, use 270 - theta

Where theta = atan(Y/X) (in degrees) in the cartesian plane.

compassDegrees = MOD(90-stdDegrees, 360)

Replies
5
Views
5K
Replies
4
Views
3K
Replies
1
Views
8K
Replies
0
Views
1K
Replies
5
Views
1K

1,219,877
Messages
6,150,714
Members
450,982
Latest member
L2LExcel

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back