Calculating Distance between two points using Geography as Data Type in Excel

Copper Contributor

Hi-

 

Can you calculate mileage between two cities using the "Geography" tool in the data types section in the data ribbon?  I would like to create a mileage driving chart for about 20 cities.

 

Thanks!

 

3 Replies

@pcull2424 

in B2 is the latitude of location 1 and in B3 the longitude

in B5 is the latitude of location 2 and in B6 the longitude

each degree - decimal

in C2 stands: = B2 * PI () / 180

copy to C6

 

The distance in km is:

= TEXT (ARCCOS (SIN (C2) * SIN (C5) + COS (C2) * COS (C5) * COS (C6-C3)) * 6378,137, "#. ## 0,0") & "km "

 

If you don't know how to convert to decimal:

in F1 the hours / in G1 the minutes / in H1 the seconds

= F1 + G1 / 60 + H1 / 3600

 

Enclosed a calculation file

Great circle navigation = distance calculations on the earth's surface:

Got this from the Internet, don't know where, but in my notes there is this file from a Mr. Klaus Kühnlein who is/or was the Pope in this area in German-speaking countries.

It's really a great job...WoW!

 

Hope I could help you with this information.

If this information helped you, please mark this post as "Correct answer" and click on like (hand with thumbs up), so that other members can benefit from this information later. 

 

Nikolino

I know I don't know anything (Socrates)

 

 

 

 

@pcull2424 

Do not forget to convert the angles to radians before calculating sines or cosines.  Also, it is unlikely that the curvature of the Earth is going to affect the distances you drive that much, the deviations from the straight line route required to follow the highway are far more significant.