+ Reply to Thread
Results 1 to 8 of 8

Distances betwteen two zip codes

  1. #1
    Forum Contributor
    Join Date
    10-18-2010
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    124

    Distances betwteen two zip codes

    I am looking for a way to reference a zip code of a customer on my estimate sheet against the zip code I life in to determine the approximate distance of the job. Thanks for any help in advance.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Distances betwteen two zip codes

    You would probably need to have a helper sheet with each zip code listed and the approximate distance from where you live. You could then use a lookup function to display it on your estimate sheet.

  3. #3
    Forum Contributor
    Join Date
    10-18-2010
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    124

    Re: Distances betwteen two zip codes

    Do you think there is a way to do this using a reference through google maps/earth or mapquest?

  4. #4
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Distances betwteen two zip codes

    This function uses Google Maps (not the API) and returns the distance between 2 addresses. It can called from VBA or as a worksheet cell function. For example with the start address in A1 and the end address in B1, in C1 enter =GMaps_Distance(A1,B1). The addresses can be any address, location, latitude and longitude coordinates, zip code, post code, etc.
    Please Login or Register  to view this content.
    Post responsibly. Search for excelforum.com

  5. #5
    Forum Contributor
    Join Date
    10-18-2010
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    124

    Re: Distances betwteen two zip codes

    The macro seems to get hinged up at

    Set HTMLdoc = New HTMLDocument

    Any suggestions?

  6. #6
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Distances betwteen two zip codes

    Oops! Change that line to:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    10-18-2010
    Location
    Walla Walla, Washington
    MS-Off Ver
    Excel 2007
    Posts
    124

    Re: Distances betwteen two zip codes

    There is still an issue. not sure where. Do you mind taking another look? Thanks. Merry Christmas everyone.

  8. #8
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Distances betwteen two zip codes

    What is the issue? Does it display an error? Is the distance returned blank or incorrect? Here is the complete code again, including a test routine which displays "2,764 mi" for me.
    Please Login or Register  to view this content.
    If the distance returned is blank, it means that id=altroute_0 doesn't exist in the Google Maps web page when the code is run in USA, so you will have to examine the HTML source to find the correct id and maybe modify that part of the code slightly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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