Calculating trip distance using Excel spreadsheet

doxadevelopment

New Member
Joined
Apr 8, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Dear all,

I am having trouble with adding a formula in the Excel cell for calculating the trip distance between two destinations. Does it have to link to Google map?

Thank you.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I answered a similar question today. See post#12 in this thread using GoogleMaps API.


Example:
Book1
ABCDE
1OriginDestinationDistanceDuration
2Dallas, TexasIrving, California2,287 km20 hours 38 mins
3RG8 7JFWA7 5PS299 km3 hours 17 mins
475094945592,824 km1 day 2 hours
5Disney Land, FloridaSpace Needle, Seattle4,959 km1 day 21 hours
6
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=GetDistance(A2,B2)
D2:D5D2=GetDuration(A2,B2)
 
Upvote 0
I answered a similar question today. See post#12 in this thread using GoogleMaps API.


Example:
Book1
ABCDE
1OriginDestinationDistanceDuration
2Dallas, TexasIrving, California2,287 km20 hours 38 mins
3RG8 7JFWA7 5PS299 km3 hours 17 mins
475094945592,824 km1 day 2 hours
5Disney Land, FloridaSpace Needle, Seattle4,959 km1 day 21 hours
6
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=GetDistance(A2,B2)
D2:D5D2=GetDuration(A2,B2)
Hi Cubist,

Do I have to download Google API?

Thank you.
 
Upvote 0
Hi Cubist,

Do I have to download Google API?

Thank you.
You don't have to download it but must make an account. The free version is fine depending on your purpose. All you need is an API Key and replace that in the code provided in the other thread. See this link on how to get started.
 
Upvote 0
Hey, I tried the VBA just throws a value error. Would it need a JSON parser to go along?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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