How to calculate Driving Distance Matrix on Excel using Bing Maps API

Sdílet
Vložit
  • čas přidán 21. 07. 2024
  • This is a small tutorial video on how to generate a distance matrix on excel using Bing Maps API. Everything is explained in detail. This video is extremely useful for a Supply chain professional who is trying to perform Vehicle routing / Network analysis / Logistic cost analysis / Location Planning / Logistics Planning. It provides the road distance along the best routes considering traffic.
    Link for GetDistance formula: drive.google.com/file/d/1zfrQ... (for windows version)
    This may not work in Mac OS, due to limitations of Apple Mac.
    If you need Travel time aswell, post this below code in your vba window and use GetTravelTime formula in the same format as GetDistance as explained in the video.
    drive.google.com/file/d/1Dyao...
    output will be travel time in minutes
    If you are getting an error, it means the formula is not giving you any relevant information.
    Here are the general reasons which I know result in such errors. (in the order of the likelihood)
    1. If you are using a macbook. The Excel in macbook does not have a web service function, which is essential for Excel to talk to the internet.
    2. If you are using Windows, but on a work laptop where Excel application may not have access to the Internet service. To validate if this is the case, I suggest trying the Webservice function to see if you are getting a relevant output. If you are getting an output, this may not be the reason. And if you are not getting the output, this is the issue and you need to talk to your IT admin or do this on your personal laptop. Reference: exceljet.net/excel-functions/...
    3. If you are sure 1&2 are not the reasons, There could be an error in the source coordinates and destination coordinates or the Bing key that is inserted into the GetDistance formula. Request you to kindly revisit the video and verify.
    4. You need to save the file in .xlsm format.
    About me:
    I am a student at NITIE Mumbai, batch of 2019-2021. NITIE (National Institute of Industrial Engineering) is a leading academic institution in generating world class supply chain and operations professionals. It is also popularly known as "The Mecca of Supply chain".
    Link: www.nitie.ac.in
    #bingmaps #distancematrix #excel
    To Connect with me:
    Email: hemu161095@gmail.com

Komentáře • 171

  • @YogeshSureka
    @YogeshSureka Před 3 lety +6

    Very structured & elaborate explanation. Must watch for all aspiring learners.

  • @sudheerkumar6427
    @sudheerkumar6427 Před 3 lety +2

    Good work Hemanth Boddapu... expecting more videos from you..

  • @DVul
    @DVul Před 27 dny

    Thank you Hemanth, fantastic video and very straightforward and helpful, I'm a supply chain professional and this was perfect!

  • @lucastavares3470
    @lucastavares3470 Před 3 lety +7

    You have help me a lot ! I’m making a cost sheet , using Kilometers from every city from state of São Paulo

  • @fulyaulutas4599
    @fulyaulutas4599 Před rokem +1

    This is exactly what i needed. Thank you for explaining very clearly

  • @himanshushukla3454
    @himanshushukla3454 Před 3 lety +2

    Thank you Hemanth for such insightful videos

  • @srinivasannarayanaswami5378

    Thank you Hemanth. Lucid explanation and a very useful tool. Much appreciated

  • @spvgggwdeg
    @spvgggwdeg Před rokem

    This is amazing and very, very helpful for me. Thanks a lot for the well elaborated explanation.

  • @vidaan95
    @vidaan95 Před rokem

    Hi Hemanth, this is a wonderful video. It really saved a huge amount of time for me.

  • @rajaaditya0021
    @rajaaditya0021 Před 2 lety

    Awesome sir!
    Helped a lot during SIP... Thank you so much!

  • @philcoul6905
    @philcoul6905 Před 3 lety +1

    Good work. This exactly what was looking for. Keep up.

  • @blue0152
    @blue0152 Před 2 lety +2

    THANK YOU! You did miss that input for Source and Destination coordinates. Also you could have clarified the best way to get the coordinates in the database tab. OTHERWISE, this is an excellent video and I really appreciate it!

  • @leroyjenkins5679
    @leroyjenkins5679 Před 2 lety +6

    Excellent hemant, just one observation though - Since api keys have limits, every call is precious. Hence filling only the upper half of the diagonal would have been wise. Also from efficient programming perspective it is important

  • @TheArtlessArtist
    @TheArtlessArtist Před 3 lety +1

    Lovely work Hemanth
    Keep up the good work ❣️

  • @sohamdsouza
    @sohamdsouza Před 3 lety +1

    Great work Hemanth !

  • @ssaravananp1
    @ssaravananp1 Před 3 lety +3

    Dear Mr.Hemanth, It was a useful App. We have around 25 rows and columns in our Application. The macro works correctly upto 12 rows and columns. From 13th row and column, there is a difference of at the least 2 Kms. Please guide us.
    Regards,
    S.Saravanan

  • @widhyawanjuliaris3939
    @widhyawanjuliaris3939 Před měsícem

    thank you very much for the knowledge. you've helped me in many ways.

  • @gouthamsolleti4316
    @gouthamsolleti4316 Před 3 lety +1

    Good work bro....working perfectly....

  • @Bhoomisolanki0210
    @Bhoomisolanki0210 Před rokem

    Very Helpful video, Thank you !

  • @catquynhnguyenle3604
    @catquynhnguyenle3604 Před 3 lety

    Thank you so much for providing this video

  • @alexanderbarlse2875
    @alexanderbarlse2875 Před 2 lety +4

    Hi there! Thank you for this great piece of code, it helped me a lot. However, i'm having a small issue. The code was running perfectly well yesterday. However, men reopening the xlsm file today, and trying to use the getdistance function, I get the error: #NAME?. Do you have any suggestions?
    Thank you.

  • @siddharthamodukuri7112

    Thanks Hemanth, Very helpful

  • @jamesa7576
    @jamesa7576 Před 3 lety +1

    This is awesome! Thank you

  • @RodrigoSebastianBuchiniz
    @RodrigoSebastianBuchiniz Před 2 lety +1

    Genial! Gracias muy útil y muy bien explicado!

  • @hakanyldz9977
    @hakanyldz9977 Před 3 lety

    Can we draw route line inside the excel bing map for to make travelling salesman problem?

  • @lucastavares3470
    @lucastavares3470 Před 3 lety

    Omg man , awesome work

  • @Antizokker
    @Antizokker Před rokem

    Thanks for the Video! But how do i get the field like B11 and which are necessary for the automasation to fill out the Matrix??

  • @eetigupta7840
    @eetigupta7840 Před 2 lety +1

    Hi, your video helped me a lot in my client deliverable. Thanks a ton.
    Is there a possibility to get the travel time for a particular date and time? I am looking to calculate travel time for historical date and time

  • @faisalalkaabneh4020
    @faisalalkaabneh4020 Před 3 lety

    this is amazing, thanks a lot :)

  • @lucastavares3470
    @lucastavares3470 Před 3 lety

    Greetings from Brazil 🇧🇷

  • @prafullgoyal24
    @prafullgoyal24 Před 3 lety +2

    Awesome...I need to hit like button for tonnes but have to satisfy with 1 only..✌

  • @nicolesamson380
    @nicolesamson380 Před rokem

    This works perfectly, Thank you so much Hemanth. When im working on a larger data set it takes quite a lot of time for it to fetch the distance, is there any work around for that?
    TIA.

  • @grizzoff
    @grizzoff Před 3 lety

    Amazing! Thank you!!

  • @sergio_molinari
    @sergio_molinari Před 2 lety

    Hello great tutorial!!
    I noticed that it considers the Highways, how can I not consider them in the search?
    Thank you

  • @anitasunildesai
    @anitasunildesai Před 2 lety

    hello Hemanth, can we do the same giving lat and long instead of name of cities? how?

  • @MrJaawt
    @MrJaawt Před rokem +1

    right now the calculation automatically grabs the shortest distance and not the interstate distance. how could I change the VBS Module to show the shortest interstate distance? But thank you very much for this so far

  • @WorkEasyGo
    @WorkEasyGo Před rokem

    Hi How did you connect database to sheet one. Can someone please help me out with the formula.

  • @tommyexceltricks7665
    @tommyexceltricks7665 Před 2 lety

    Hello , Thanks for this tutorial
    can i ask about something
    Q1:why ther's diffrence between bing maps and Google maps
    Ex: two cordination ( lat,long) in bing maps : 16 Km -- Google maps : 13
    Q2:some times result returned from bing maps doesn't exact the result already in bing maps if you switched to bing maps and tried to get direction to comapre result in excel file with data in bing maps
    thanks in advance

  • @karstenhaberkorn6182
    @karstenhaberkorn6182 Před 3 lety +6

    Hello Hemanth, this is really very helpful and a great tool - thank you for that! Can you also advise, on how to get coordinates (latitude and longitude) back from bing maps for given locations? This would be very helpful, in case you need coordinates for many addresses (comparable to the list of locations you put into the "database sheet"). Many thanks for any advice! Karsten

    • @jacky_23
      @jacky_23 Před 3 lety +1

      I had this problem and used power query web connector

  • @sherifhassan1556
    @sherifhassan1556 Před 3 lety

    Hemanth I hope you're well. This is an excellent tutorial, thank you. Unfortunately, I keep getting #NAME? error when running the GetDistance macro. Any suggestions? Thanks again. Syh

  • @sidneyro5554
    @sidneyro5554 Před rokem

    Hi, excellent tutorial. Would you help me .the negative coordinates of the error how do I?? positive coordinates works. thanks🙂

  • @TrudiDay
    @TrudiDay Před rokem

    Awesome - thank you!!

  • @narejo223
    @narejo223 Před 2 lety

    lastVal = "&travelMode=driving&o=xml&key=" & key & "&distanceUnit=mi" if for meters than what will be correct code instead of miles

  • @irenesolmone7667
    @irenesolmone7667 Před rokem

    Hi! I used the formula and everything worked perfectly well for a while. Now, excel isn't recognizing the formula anymore. Do you have any advice on how to solve this?

  • @katieallinson5781
    @katieallinson5781 Před 3 lety +1

    Hemanth - please please can you tell me how to make bing maps return the longest distance between two points.

  • @TomCat-hp6mi
    @TomCat-hp6mi Před rokem

    I want to do something similar. I want to know the distance travelled by the train from station A to station B. Please tell me how to do it.

  • @superintendentofpolicememb3560

    Thanks but I follow your instruction but GetDistance formula not shown in Excel-2019

  • @alejandrapinoncely7040

    Hi! great job! The code is working but not for every city. I am having trouble with cities in Asia, more specifically within China, Japan and Korea Could you help me with that?? Regards, Alejandra

  • @aphastus
    @aphastus Před 2 lety +1

    Wow I tried not knowing if it’d work because I’ve never coded in VBA and I did a couple mistakes that I was able to detect and understand watching my code and yours (mostly cells placements). I used the time instead of the distance. It is incredibly satisfying watching the code fill all the cells in the matrix. I started in Mac but the getdistance formula didn’t work. I’ll try it later to see if something wasn’t correct. What bugged me is that every version of office uses different separators, you used a , and I had to change it to a ; so probably it’s the same problem with Mac. Anyway, thanks so much for the video, it was so nice!

    • @HEMANTHHEMU86
      @HEMANTHHEMU86  Před 2 lety

      Hey.. the issue with mac is that excel in mac cannot talk to internet. Pls try with windows. I've mentioned the same in the description box

  • @dindazalfa
    @dindazalfa Před 2 lety

    Hello Hemanth, can you help me to make vba code for calculate distance and travel time without toll usage in BingMaps?

  • @RafiqueNoorie
    @RafiqueNoorie Před 3 lety

    It is not mapping the distance which you was taken an another excel sheet2. How we can merge into excel sheet 1?

  • @matinamoozadeh235
    @matinamoozadeh235 Před 3 lety

    my excel shows the error Sub distMatrix does not define, what is the problem?

  • @2909remco
    @2909remco Před 3 lety +2

    Thank you for this great video. Would it be possible to also provide the associated GetTravelTime code? Much appreciated

  • @subhendupradhan6475
    @subhendupradhan6475 Před 3 lety

    it is throwing an error "invalid outside procedure". Please Help

  • @bhargavagatla3583
    @bhargavagatla3583 Před 5 měsíci

    Hi.. Can we get the distances by pincode to pincode

  • @ranjitsakhare
    @ranjitsakhare Před rokem

    Hemant thanks a lot. Its helping a lot. Like function GetDistance can you help with GetTime as well?

  • @vigneshkr9497
    @vigneshkr9497 Před 2 měsíci

    how to do this between pincodes within the city?

  • @gokaykkaya
    @gokaykkaya Před 7 měsíci

    can this method be used for 80 locations?

  • @rasraster
    @rasraster Před rokem

    Very nice, thank you. Can this be done with HTTPS instead of HTTP?

  • @Suman-vv5gv
    @Suman-vv5gv Před 11 měsíci

    Thanks for this Video ...

  • @saikiran-zn4cq
    @saikiran-zn4cq Před 3 lety +1

    Thanks dude.

  • @TheNitoperez
    @TheNitoperez Před rokem

    Desde Mexico.... funciona al 100%

  • @adrianesc7706
    @adrianesc7706 Před rokem +1

    What if i don't have the coordinates?

  • @osamarizwan1635
    @osamarizwan1635 Před 2 lety

    how can we get the distance in meters?

  • @guonorman51
    @guonorman51 Před rokem

    Thanks for your video clip

  • @jacky_23
    @jacky_23 Před 3 lety

    Good video !!

  • @arvindshaker1984
    @arvindshaker1984 Před rokem

    hi it was used full to me but it is not working on my excell
    pls give excel which is red to used

  • @meetyadav416
    @meetyadav416 Před rokem

    Awsome dude 😮

  • @SiBull
    @SiBull Před rokem

    How to get coordinate automatically trough excel?

  • @bubblesarita1428
    @bubblesarita1428 Před rokem

    Excellent👍

  • @13_pritamsanyal41
    @13_pritamsanyal41 Před 4 měsíci

    Hey, why the marix is not symmetric ?

  • @jenildesai5565
    @jenildesai5565 Před 4 měsíci

    This code is working for India's coordinates. But it is not working for USA coordinates.
    Please help.

  • @hasinrizwan5724
    @hasinrizwan5724 Před 2 lety

    Great video brother, Very helpful for me... Can you tell how to convert this Excel data into numpy array?

  • @rohitmishra4253
    @rohitmishra4253 Před rokem

    where will i get all coordinates ??

  • @ambarukanasubrahmanyam51

    excellent video

  • @Michael-zg5cx
    @Michael-zg5cx Před 6 dny

    Hey
    Great work! I used your code for two years now. But with the change to Azure Maps I don't get this think working anymore... can you make a new video where you explain how to use Azure Maps API instead of Bing Maps?

  • @rohitdadi7898
    @rohitdadi7898 Před 7 měsíci

    Can you share the link....of the code pls......hyperlink is missing

  • @TAMALCHOUDHURYROY
    @TAMALCHOUDHURYROY Před 3 lety +1

    Hello Hemanth,
    In my pc excel 2013 / office 365, formula "=getdistance" is not showing
    Can you please help me how can I resolve this issue?

    • @HEMANTHHEMU86
      @HEMANTHHEMU86  Před 3 lety

      I have provided a peice of VBA code in the description. Please do paste it in your vba window.

  • @user-ns4tw5lw1r
    @user-ns4tw5lw1r Před 10 dny

    Why we used this all it's all available in map when we enter two cities distance in map it's showing

  • @almemo9
    @almemo9 Před 2 lety

    Juest amazing, you save me two days of work, just an small question, for big volume of data, the formula gives me #value message, any ideas? thanks in advance

  • @unnikrishnansanthosh
    @unnikrishnansanthosh Před 2 lety

    hi Hemanth, thank you very much for sharing such an useful tutorial, great work. I would like to know whether you have a tutorial for calculating air distance

    • @unnikrishnansanthosh
      @unnikrishnansanthosh Před 2 lety

      Also, one more query, what is the base for calculating travel time - like is it based on speed limits of the roads or peak time / off peak time traffic on the roads

    • @HEMANTHHEMU86
      @HEMANTHHEMU86  Před 2 lety

      time is given by Bing, based on the traffic data. just like Google provides on estimated time.

  • @mujeebshaikh5537
    @mujeebshaikh5537 Před 2 lety

    #value! Why it's throwing this error ?

  • @josegutierrez4969
    @josegutierrez4969 Před 2 lety +1

    I LOVE YOU

  • @ghanshyamsinhdvadher3119

    Thanks great help, can u check the same can be converted into AddIn, i was unable to do it

  • @Alphabah95
    @Alphabah95 Před 2 lety +3

    Hello, I found your video very helpful for my project, I am a master's degree student. I had some issues linking the geographical coordinates to the distance Matrix like you did, can you explain to me or send me the excel file you did the demonstration on CZcams? so I can refer to that to build my own matrix?
    Thank you your help will be really appreciated.

    • @michalzila7084
      @michalzila7084 Před rokem

      I tried it and i doesn't work. Variable not defined.

  • @gowthamseshadri5118
    @gowthamseshadri5118 Před 2 lety

    How to get the coordinates for any locations using API. It is really difficult to get lat & long for every locations manually. Please guide me.

    • @HEMANTHHEMU86
      @HEMANTHHEMU86  Před 2 lety

      It's not difficult. There are Google and Bing APIs for that

  • @hakanyldz9977
    @hakanyldz9977 Před 3 lety

    After you copy and paste key password on the cell B9 then automatically appeared word "KEY" on cell A9. How do it?

    • @HEMANTHHEMU86
      @HEMANTHHEMU86  Před 3 lety +1

      It was not automatic.. i have written it in that cell.. i have fast forwarded the video at bit over thete

  • @ankurdikshit4669
    @ankurdikshit4669 Před 3 lety +2

    followed all the steps, still after using formula excel is returning #value! error, may i know how can it be resolved

  • @giannacardenas6189
    @giannacardenas6189 Před 3 lety

    Hi! This API has a limit of requests? I want to know if I can calculate the distance in a matrix 480x480 long 😬😬

    • @HEMANTHHEMU86
      @HEMANTHHEMU86  Před 3 lety

      It has a limit of 1,25,000 requests. If you want to get 480*480, its better if you can write code for either upper half of matrix or the lower half only

  • @DAANoLOOF
    @DAANoLOOF Před 2 lety +1

    Hi Hemmath, is the distance calculated over the road or in a straight line? Either way, thank you for the tutorial!

    • @NathanaelHarwood
      @NathanaelHarwood Před rokem

      Just for others' sake - the description states 'It provides the road distance along the best routes considering traffic'

  • @uyenphamthithuuyen1903

    Hi, your video is really helpful. However, I don't know how to obtain the longitude and latitude from Bing Maps. Can you create a video how to do that, please?

    • @filippomauro4846
      @filippomauro4846 Před 2 lety +2

      in excel you can write the location in a cell (es. Rome), than select the cell that contain the location, go to data-->data types-->geography and extrapolate latitude and longitude clicking on small icon that appears next the location cell. In a third column you can use the function =concat(cell latitude, "," ,cell longitude) and you have the coordinate of location

  • @swaaditya
    @swaaditya Před 3 lety

    The tool is great however, can we get the longitude and latitude automatically from bing maps or google maps? As, for all 1000 plus service locations we cannot manually input them right?

    • @HEMANTHHEMU86
      @HEMANTHHEMU86  Před 3 lety +1

      If you mean getting coordinates from addresses, there are similar ways to do it. But it's accuracy is low.. i have observed it gets offset by 10-12 kms sometimes

    • @swaaditya
      @swaaditya Před 3 lety

      @@HEMANTHHEMU86 If thats the case then for each and every address there needs to be an input provided manually. Please share further insight by mailing me on swaaditya@gmail.com. I would be of great help as am trying to work on route optimization in my project as well

  • @shehanwijeyawansa1372
    @shehanwijeyawansa1372 Před 3 měsíci

    Thank You

  • @SaurabhPratapiitkgp
    @SaurabhPratapiitkgp Před 3 lety

    How you are getting the source and destination coordinates

    • @HEMANTHHEMU86
      @HEMANTHHEMU86  Před 3 lety

      Like i said in the video... I already have them. You can get the coordinates through the Bing maps API aswell.. but it isn't that effective. There are many open source websites with coordinates for each pin code. You can try that.

  • @Gabriel-Oliveira
    @Gabriel-Oliveira Před 3 lety +1

    Hi Mr. Boddapu. Firstly, I really appreciate the time you spent recording this video. It was really important for my understanding when it comes to create a distance matrix.
    I have a question, if I have 12 locations, I think the total number os distances would be 144 (12*12) instead of 66, am I right?
    Cheers from Brazil!

  • @thatgoanguy4427
    @thatgoanguy4427 Před 4 měsíci

    Im getting #value error, idk why

  • @yigityldz1089
    @yigityldz1089 Před rokem

    im getting a theres a problem with this formula error. Can you help me please

    • @yigityldz1089
      @yigityldz1089 Před rokem

      I solved, put ; instead of , on your getdistance formula.

  • @user-vd8nb7eq5y
    @user-vd8nb7eq5y Před 11 měsíci

    您好,我获得了负距离。这是什么原因

  • @muhammadabdulazizbaigattar9619

    its not working plz help

  • @younessfrichi2156
    @younessfrichi2156 Před 3 lety +3

    Thank you for the video. Please how can we get the travel time instead of the distance?

    • @HEMANTHHEMU86
      @HEMANTHHEMU86  Před 3 lety +2

      Very simple, in the code i have attached, towards the end of the code, there is a phrase "//TravelDistance". You need to replace it with "//TravelDuration" and remove 1.609 multiplier

    • @younessfrichi2156
      @younessfrichi2156 Před 3 lety +2

      @@HEMANTHHEMU86 Thank you. It works :)

    • @nanakipshidze3898
      @nanakipshidze3898 Před 3 lety

      @@HEMANTHHEMU86 thank you for great video. is it possible to calculate walking distance instead of driving distance?

    • @khinthiri1061
      @khinthiri1061 Před 2 lety

      @@younessfrichi2156 Hello!! I also want to calculate the travel time. Could you please give me some reference coding for calculating the travel time instead of travel distance?