Forum Discussion
Distance between Latitude and Longitude in Excel
How can I derive the distance between two points in Excel given Latitude and Longitudes?
5 Replies
- PeterBartholomew1Silver Contributor
Worksheet formula = GreatCircDistλ(origin, destination) GreatCircDistλ =LAMBDA(p₁, p₂, LET( ϕ₁, RADIANS(p₁.[latitude]), λ₁, RADIANS(p₁.[longitude]), ϕ₂, RADIANS(p₂.[latitude]), λ₂, RADIANS(p₂.[longitude]), r, 6378, r * ACOS(SIN(ϕ₁)*SIN(ϕ₂) + COS(ϕ₁)*COS(ϕ₂)*COS(λ₂-λ₁)) ) )
- PeterBartholomew1Silver Contributor
This was used as a demonstration problem when Lambda functions were first released
LAMBDA Examples: Distance between two cities - Microsoft Community Hub
What gets fun is when geography rich data types are used to generate a complete itinerary.
- HecatonchireIron Contributor
Hello,
Point A =>A2/B2 (ex : 45.762°/4.822°)
Point B =>C2/D2 (ex: 44.869°/-0.533°)
Result : 430 Km
=2*6371*ASIN(RACINE((SIN((RADIANS(C2)-RADIANS(A2))/2))^2+COS(RADIANS(C2))*COS(RADIANS(A2))*(SIN((RADIANS(D2)-RADIANS(B2))/2))^2)) =ACOS(SIN(RADIANS(A2))*SIN(RADIANS(C2))+COS(RADIANS(A2))*COS(RADIANS(C2))*COS(RADIANS(B2-D2)))*6371 - mathetesSilver Contributor
Your question piqued my curiosity, and a quick Google search brought up this information. And that, following the suggestion of a Haversine formula, led to this answer to your question: how to perform distance calculation using Excel.
Have at it.
- mathetesSilver Contributor
How can I derive the distance between two points in Excel given Latitude and Longitudes?
How would you do it without Excel? That's not meant to be a dismissive question; rather, if I knew how to do it "on paper" or with pencil and paper and some other information on latitude and longitude lines and how they're determined in the first place, then I might be able to say how to do it with Excel.
My sense, though, is that it's not readily answered by just knowing, say,
and
If you can use formulas to tell us the distance between those two points, and tell us how you did it, I might be able to tell you how Excel could accomplish the same. Now, I happen to know the distance between those two points when driving by car, so I'll be able to determine whether your answer is plausible.