If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back  dBforums > PC based Database Applications > Microsoft Excel > Formula for straight line distance between two waypoints

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Jan 2009
Location: Louisiana, United States
Posts: 163
Formula for straight line distance between two waypoints

Here's an Excel formula for calculating the straightline distance between two waypoints, given the curvature of the earth. I put this together originally to try to determine which of our distribution centers should service which zip codes. It wasn't much use for that application but I have found many other uses for it. There are plenty of sites with zip code lists including lat and long if that is what you want to do. Latitude and longitude values must be in degrees (which is the way you'll usually see them). Just thought it might benefit others. Joshua

Quote:
=IF(SIN(RADIANS(From Latitude))*SIN(RADIANS(To Latitude))+COS(RADIANS(From Latitude))*COS(RADIANS(To Latitude))*COS(RADIANS(From Longitude)-RADIANS(To Longitude))>1,3963.1*ACOS(1),3963.1*ACOS(SIN(RADIA NS(From Latitude))*SIN(RADIANS(To Latitude))+COS(RADIANS(From Latitude))*COS(RADIANS(To Latitude))*COS(RADIANS(From Longitude)-RADIANS(To Longitude))))
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Nov 2012
Posts: 2
Trying to use formula for distances between waypoints.

I am creating an application to calculate the distance between airports. I believe your formula should handle this. I have a spreadsheet with four columns titled: From Latitude, From Longitude, To Latitude, and To Longitude. The fifth column is for Distance.
I plugged your formula into column 5. I get a "VALUE" error. Obviously I'm missing something here, or I have a syntax issue. I have included my first row of waypoints. I know the distance should be about 180 miles. I appreciate your comments.
N58 43' 42.01",W156 56' 25.35" and N58 40' 36.49",W156 38' 57.18"
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Jan 2009
Location: Louisiana, United States
Posts: 163
Spreadsheet

Tom,

I'm attaching a spreadsheet calculator used to calculate the distance between zip codes using their lat/long. You can either set the from/to zip in the top section to see the distance between the two or set the from and look at the zip codes in the bottom section to see how far each is from the "from" zip code. Let me know if you have any other questions. Make sure you are working with degrees or radians as needed. That can be a little confusing.

Joshua
Attached Files
File Type: zip Zip Codes - Straight line distance between 2 points.zip (3.15 MB, 28 views)
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Nov 2012
Posts: 2
Distance between two waypoints

Thanks Joshua.
That spreadsheet is exactly what I was looking for.
Tom
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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