I recently had a need to calculate distance between a large number of latitude/longitude coordinate pairs. There are many options available if you want to import these in a GIS and run analysis. But there is a simpler and much more accesible way if you aren’t doing very high accuracy calculations.

Here I have a spreadsheet which implements the well-known Haversine formula to calculate distance between 2 coordinates. You can structure your point coordinates into 4 columns Lat1, Lon1, Lat2, Lon2 in decimal degrees and the distance will be calculated in meters.

You can give it a try. Just open this spreadsheet, make a copy it and play with it as you like.

The raw formula is below (Thanks to the reader Samuel who suggested it)

`=2 * 6371000 * ASIN(SQRT((SIN((LAT2*(3.14159/180)-LAT1*(3.14159/180))/2))^2+COS(LAT2*(3.14159/180))*COS(LAT1*(3.14159/180))*SIN(((LONG2*(3.14159/180)-LONG1*(3.14159/180))/2))^2))`

If you are working with coordinates in a spreadsheet, check out this post on converting Lat/Lon coordinates to UTM coordinates dynamically in a spreadsheet.

### Like this:

Like Loading...

to calculate distance between two latitude longitude you can use website https://www.latlongfinder.net/lat-long-distance-calculator

i need WGS84 formula (not haversine)

WGS84 formula is Vincenty’s Formulae. It is quite complex to implement in a spreadsheet. There are 2 alternatives

1. Use Python https://courses.spatialthoughts.com/python-foundation.html#calculating-distance-1

2. Use QGIS Python API: https://courses.spatialthoughts.com/pyqgis-in-a-day.html#calculating-distance-using-pyqgis

it works.. WOW

It works perfectly 🙂 thanks pal.

~Jeevan Maradi | Homestay Advisor

Thank you so much for this sharing, it’s save my holidays.

This distance is in miles/ KM what is the UOM.

Distance is in meters. 6371000 is the radius of earth in meters. If you use the radius in any other units then the result would be in that unit.

thanks I used it and it worked!