# Thread: Formula for straight line distance between two waypoints

1. Registered User
Join Date
Jan 2009
Location
Ohio, United States
Posts
167

## Unanswered: 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

=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))))

2. 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"

3. Registered User
Join Date
Jan 2009
Location
Ohio, United States
Posts
167

## 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

4. Registered User
Join Date
Nov 2012
Posts
2

## Distance between two waypoints

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

#### Posting Permissions

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