+ Reply to Thread
Results 1 to 4 of 4

Calculate Compass Heading between Points

  1. #1
    Registered User
    Join Date
    05-10-2019
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    2

    Calculate Compass Heading between Points

    This is a bit of an odd one but I currently have a project where waypoints are plotted grid.

    I have a means of calcualting the length of each leg between waypoints with some simple trigonometry but I need to be able to calculate the compass heading of each one too; there's a few ideas swimming around in my head but my brain has stopped working now it seems.

    Any help is greatly appreciated, many thanks

    1.PNG

    2.PNG

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Calculate Compass Heading between Points

    Can you attached your file here, please? I don't see on snap any sensitive data so should be ok.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,869

    Re: Calculate Compass Heading between Points

    Getting bearings should still be simple trig. I find that a lot of trig is easier if I understand the unit circle. I made a spreadsheet here to illustrate the unit circle in Excel: https://www.excelforum.com/tips-and-...ml#post4309792 I think the trickiest part of this for many will be the switch from the standard "angles are referenced to the positive x axis" convention that standard trig uses and the compass bearing convention where angles are referenced to the positive y axis (north). I recommend you spend a few minutes with the unit circle and compass bearing convention to make sure you understand what is happening.

    Once you have a handle on that, then getting compass bearing from your data points becomes a simple ATAN2() function: https://support.office.com/en-us/art...8-c96b3a565033 Recognizing that y is now the equivalent of the x (cosine) argument and x is now the equivalent of the y (sine) argument, the angle from point 1 to point 2 is simply ATAN2(M3,L3).

    Then you must remember that, like all programming languages, Excel does trig in radians, so you need to convert the result from radians to degrees. DEGREES(ATAN2(M3,L3)). Then note that the ATAN2() output is -pi() to +pi() radians (-180 to +180 degrees) -- and most who deal with compass bearings want output from 0 to 360. Usually this is accomplished with a MOD() function =MOD(DEGREES(ATAN2(M3,L3)),360)
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    05-10-2019
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Calculate Compass Heading between Points

    Thanks very much for your help all, have now solved the issue.

    I took a slightly more convoluted route, so after working out which Cartesian quadrant the end of the leg/vector was I was able to produce the follow the following formula which does the trick, although I'm sure it could be simplified hugely

    =IF(ISBLANK(G4),"-",IF(AND($L4=0,$G4>$G3),90,IF(AND($L4=0,$G4<$G3),270,IF(AND($K4=0,$H4>$H3),180,IF(AND($K4=0,$H3>$H4),360,IF($O4=4,90+DEGREES(ATAN($L4/$K4)),IF($O4=2,270+DEGREES(ATAN($L4/$K4)),IF($O4=3,270-DEGREES(ATAN($L4/$K4)),90-DEGREES(ATAN($L4/$K4))))))))))

    A.PNG

    B.PNG

    Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 08-05-2015, 06:18 PM
  2. Replacing Minus Signs on Angles with N/E/S/W Compass Points
    By Keith360 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-20-2014, 05:35 AM
  3. Heading between two points (north, south)
    By peerogel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-28-2014, 11:20 PM
  4. Replies: 1
    Last Post: 04-09-2014, 01:33 PM
  5. [SOLVED] IF Function to assign Compass Quadrants to Values
    By iainl in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-14-2013, 09:40 AM
  6. how to create a compass rose graph
    By maschette in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-08-2012, 06:16 AM
  7. compass heading calculation
    By jaypee in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-05-2007, 11:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1