Calculate Distance between two addresses without API

ardykav

Board Regular
Joined
Oct 18, 2015
Messages
172
Office Version
  1. 365
Platform
  1. Windows
I had some code years ago which allowed me to enter a formula eg =getdistance(A1,B1) in a cell and it would calculate the distance between two addresses. Would anyone know if this is still able to be used or where I could find it?

thanks
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi Ardykav,

I don't see how actual distance could be calculated without some kind of API to a mapping tool but you can approximate direct distance given two longitude and latitude co-ordinates.

Ardykav-Distance.xlsx
ABCD
1LatitudeLongitudePlaceDistance (kms)
251.50776-0.12793Nelson's Column, London
354.91255-1.58621Angel of the North, Gateshead390.8275689
Sheet4
Cell Formulas
RangeFormula
D3D3=ACOS(COS(RADIANS(90-A3)) *COS(RADIANS(90-A2)) +SIN(RADIANS(90-A3)) *SIN(RADIANS(90-A2)) *COS(RADIANS(B3-B2))) *6371
 
Upvote 0
Yeah I thought as much too but it definitely worked a few years ago although it was about 7 years back now. Regards the lat long thats great, is there a quick way of bringing the lat long in or is that an API job too?

thanks for responding,
 
Upvote 0
You can get individual Longitude & Latitude from Google Maps.
Some years ago I used some online batch conversion services to convert addresses and another to convert postcodes but I can't remember the URLs.
 
Upvote 0
I've used the same trig formula that Toadstool proposed and it works find (at least for the need I had).
I also used this fairly large file (options include CSV, Excel, etc.) with zip codes (43,000+) and the respective longitude and latitude.
Hope this is helpful.

US Zip Code Latitude and Longitude
 
Upvote 0

Forum statistics

Threads
1,217,999
Messages
6,139,889
Members
450,246
Latest member
CellMaster

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