Hi,
I want to calculate distance and duration for multiple cities. I wish to get this data
for example :
ex.xlsx
if you have any excel file for example with the VBA or other code it will be great.
Thanks!
Lior
Hi,
I want to calculate distance and duration for multiple cities. I wish to get this data
for example :
ex.xlsx
if you have any excel file for example with the VBA or other code it will be great.
Thanks!
Lior
Hi,
What co-ordinate system will be using for the locations?
Richard Buttrey
RIP - d. 06/10/2022
If any of the responses have helped then please consider rating them by clicking the small star iconbelow the post.
no co-ordinate , just name the origin city and destination city. thanks
If you could indicate how you would calculate or get your answer without the aid of Excel, i.e. understand your thought process maybe we could replicate that in Excel.
Otherwise why not use one of the many calculators on the web. e.g. http://www.distancecalculator.net/
I mean that you just have to rename the origin city , for example : New York, NY and Destination for example : Boston, MA and the function will return the driving distance and driving time. for sure I can check it via the google maps web site but I want to do it in a smart way because I have an excel file with more than 500 path that I have to calculate. thanks
Hi,
If you're saying that you want to do this without holding any information in the workbook and want to obtain it from a web site then you'll need to find a web site that lists this information and then use an Excel Data Connection to grab the data when you enter two cities.
Otherwise one way or another you will need to have either a 2 dimensional matrix of all the cities/towns you're interested in with the names as both column labels and row labels and the distance between them at the intersection. i.e. the usual sort of triangular matrix you see in road atlases.
Or you could pick an arbitrary city and in a two column list list all cities in the first column and the distance to the arbitrary city in the column alongside. Then once Excel knows the two cities you're interested in it could use Pythagoras's theorem to work out the distance between the two - ignoring the inevitable small error because the surface is actually on a sphere rather than a flat plane.
Use this code as a macro, then use =getgoogledistance for distance, =getgoogletraveltime for travel time.
![]()
Please Login or Register to view this content.
Last edited by CatDaddy_09; 12-01-2015 at 05:28 PM. Reason: Compliance
Unfortunately your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.
Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.
Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
(This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
omitted post
Last edited by carsto; 09-21-2018 at 01:19 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks