+ Reply to Thread
Results 1 to 8 of 8

Calculate distance between two addresses

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Calculate distance between two addresses

    Hello everyone
    I have the following UDF that calculates the distance between two addresses
    Please Login or Register  to view this content.
    But it is very slow and most of the time it doesn't return correct results ..
    There is a sample of the origonal file .. the original file has more then 15000 addresses ..
    Is there a faster way ?
    Attached Files Attached Files
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  2. #2
    Registered User
    Join Date
    09-06-2011
    Location
    Paris
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Calculate distance between two addresses

    I haven't tested this, but my hunch is that you are not going to get useable results using zip codes. They are simply not accurate enough.

    I would suggest a 2 stage proces as follows. If this does not work for you, search for the words Haversine and Vincenty in connection with Excel on Google for more options using some heavy duty trigonometry.

    1) get the latitude and longitude co-ordinates of each address. Some suggested code can be found at Chandoo's site: http://forum.chandoo.org/threads/fin...-and-vba.7253/

    2) then calculate the distances between them using the formula shown here - http://bluemm.blogspot.co.uk/2007/01...-distance.html - which I reproduce here in case the link dies (this calculates in miles).

    Please Login or Register  to view this content.
    Hope this works.

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Calculate distance between two addresses

    Thanks a lot for these useful links
    Best Regards

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Calculate distance between two addresses


  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Calculate distance between two addresses

    Thanks a lot for the link
    I inserted the udf function and refer to the refernece Microsoft XML v6.0 but got the following error
    User defined type not defined
    Please Login or Register  to view this content.
    And please put an example if possible

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Calculate distance between two addresses

    Try changing it to Microsoft XML v3

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Calculate distance between two addresses

    Thanks a lot for help
    What about YOUR_MS_KEY ?? I naviagted to the link you provided but didn't know how to get the key
    And can you post an example for the formulas =getdistance(need example) ..?

  8. #8
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Calculate distance between two addresses

    Mr. Kyle
    sorry for disturbing you .. can you provide me the code again as I noticed in replies in the original thread that some members do some changes to the code...?
    Thanks advanced for any help

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to calculate distance between coordinates
    By madelingirly in forum Excel General
    Replies: 4
    Last Post: 10-01-2015, 02:00 PM
  2. multi IF THEN with text AND distance between 2 addresses
    By kaczynski in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-26-2015, 03:08 AM
  3. Calculating distance between addresses
    By funkmeister79 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-03-2015, 01:06 PM
  4. Distance between 2 addresses
    By kaczynski in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-14-2015, 05:51 AM
  5. Freight Calculate per distance
    By mohammedalkhatim in forum Excel Formulas & Functions
    Replies: 21
    Last Post: 11-06-2013, 06:30 AM
  6. Calculate distance
    By mukesh mishra in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-09-2013, 06:23 AM
  7. [SOLVED] Calculate Distance Between Two Zip Codes
    By XUMuskies in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2013, 01:57 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1