Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

Excel formula to calculate the distance between multiple points using lat/lon coordinates

$
0
0

I'm currently drawing up a mock database schema with two tables: Booking and Waypoint.

  • Booking stores the taxi booking information.

enter image description here

  • Waypoint stores the pickup and drop off points during the journey, along with the lat lon position. Each sequence is a stop in the journey.

enter image description here

How would I calculate the distance between the different stops in each journey (using the lat/lon data) in Excel?

Is there a way to programmatically define this in Excel, i.e. so that a formula can be placed into the mileagecolumn (Booking table), lookup the matching sequence (via bookingId) for that journey in the Waypointtable and return a result?

Example 1:

A journey with 2 stops:

1   1   1   MK4 4FL, 2, Levens Hall Drive, Westcroft, Milton Keynes 52.002529   -0.797623
2   1   2   MK2 2RD, 55, Westfield Road, Bletchley, Milton Keynes   51.992571   -0.72753

4.1 miles according to Google, entry made in mileage column in Booking table where id = 1

Example 2:

A journey with 3 stops:

6   3   1   MK7 7DT, 2, Spearmint Close, Walnut Tree, Milton Keynes 52.017486   -0.690113
7   3   2   MK18 1JL, H S B C, Market Hill, Buckingham              52.000674   -0.987062
8   3   1   MK17 0FE, 1, Maids Close, Mursley, Milton Keynes        52.040622   -0.759417

27.7 miles according to Google, entry made in mileage column in Booking table where id = 3

I understand that 100% accuracy is not possible, so it will not be an issue.


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>