distance between 2 coordinates

6diegodiego9

Board Regular
Joined
Jan 9, 2018
Messages
80
Office Version
  1. 2016
Platform
  1. Windows
Consider this two point on the map:

latitudelongitude
45.617829.41737
45.485689.20181

<tbody>
</tbody>

The distance between each other is about 22km.
What's the formula to calculate that?

I tried different formulas found online but every one returned absurd values...
 
Last edited:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Found this on another thread and seems to work nicely,

Earths Radius Cell E1 = 6371
Cells A2 and A3 - latitude co ordinates
Cells B2 and B3 - longitude co ordinates

Cell E2 - =SIN(ABS(A3-A2)*PI()/180/2)^2+COS(A2*PI()/180)*COS(A3*PI()/180)*SIN(ABS(B3-B2)*PI()/180/2)^2
Cell E3 - =2*ATAN2(SQRT(1-E2),SQRT(E2))
Cell E4 - =E1*E3

Result =22.3074169491921
 
Upvote 0
Still absurd results:


latitudelongitude6371
45.617829.417370,842697
45.61766129.41758472,325941
14818,57

<colgroup><col><col><col span="3"></colgroup><tbody>
</tbody>
 
Upvote 0
Not sure what's happening then,
Works on mine,
I'm getting the below results.


earths radius 6371 Cell E1
3.06495E-06 Cell E2
0.0035014 Cell E3
22.30741695 Cell e4
 
Upvote 0
Untitled.png



Can you see any difference? :(
 
Upvote 0
Sorry I cant see the problem here,

the co-ordinates in your last post are different from your first.
Even with these new ones I get the following. I checked this with an online calculator and the distance is correct

3.63778E-12
3.81459E-06
0.024302778

<colgroup><col></colgroup><tbody>
</tbody>
 
Upvote 0
using the coordinates of my first post:

screenshot.png


I still don't understand why does the difference happen :(
 
Upvote 0
cunningAce's results seem to be correct.

You can use this single formula to calculate the distance;

Code:
=6371*((2*ASIN(SQRT((SIN((RADIANS(A5)-RADIANS(A6))/2)^2)+COS(RADIANS(A5))*COS(RADIANS(A6))*(SIN((RADIANS(B5)-RADIANS(B6))/2)^2)))))

 
Upvote 0
By the way, try to change your LAT and LON data as;

45,61782 and 9,41737

I mean; use comma (",") instead of dot (".") for the decimal point indicator..... which depends on your Excel settings.
 
Upvote 0

Book1
ABCDEF
1LatitudeLongitudeRadius6371km
245.617829.41737a3.06495E-06
345.485689.20181c0.0035014
4Distance22.30741695km
Sheet2
Cell Formulas
RangeFormula
E2=SIN((A3-A2)*PI()/360)^2+COS(A2*PI()/180)*COS(A3*PI()/180)*SIN((B3-B2)*PI()/360)^2
E3=2*ATAN2(SQRT(1-E2),SQRT(E2))
E4=E3*E1


WBD
 
Upvote 0

Forum statistics

Threads
1,222,095
Messages
6,163,891
Members
451,864
Latest member
Pandorom

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top