Excel Formula or Macros - Distance Between Two Postal Codes

LaurindaS

New Member
Joined
Jan 15, 2019
Messages
15
Hi,

I'm from Canada & I'm trying to see if there is a formula or macros I can use to calculate the distance (KM) between two postal codes.
A1 - Postal Code 1
B1 - Postal Code 1
C1 - Distance (KM)
Any help would be greatly appreciated.

Thanks,
Laurinda
 

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.
Hi Laurinda,
I have an idea, but I do not have here the latest version of Excel, I need the WEBSERVICE function (see URL Below)
Then I create the URL by a simple concat formula, I am using the HYPERLINK function BC I do not have WEBSERVICE in my 2010 Excel
Code:
=HYPERLINK("https://www.google.com/search?q=what+is+the+distance+between+"&A2&"%2C+canada+and+"&B2&"%2C+canada+in+km")
Cod 1Cod 2URL
A1A1A1X0B1B0https://www.google.com/search?q=what+is+the+distance+between+A1A1A1%2C+canada+and+X0B1B0%2C+canada+in+km
A1A1A1X0E1A0https://www.google.com/search?q=what+is+the+distance+between+A1A1A1%2C+canada+and+X0E1A0%2C+canada+in+km

<tbody>
</tbody>
And extract the distance from the answer, I will finish this tomorow
Cheers
Sergio

https://support.office.com/en-us/article/webservice-function-0546a35a-ecc6-4739-aed7-c0b7ce1562c4

 
Upvote 0
This can be done with the Google Directions API or Distance Matrix API. Code for the former is at https://www.mrexcel.com/forum/excel...ance-getgoogledistance-decimal-separator.html.

The linked code must be modified to use https instead of http and a "&key=Your_API_Key" must be added to the Google API URL. See https://developers.google.com/maps/documentation/directions/get-api-key to obtain a key and register your project/application. You must also enable billing and provide a credit card number, though Google give a $200 monthly credit.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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