+ Reply to Thread
Results 1 to 7 of 7

creating a link from a set location to a location specified in another cell (googlemaps)

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2016
    Posts
    15

    creating a link from a set location to a location specified in another cell (googlemaps)

    dear forum

    I would like to create a link to google maps that directly opens directions between two locations.

    The base location should remain the same (a UK postcode, e.g. n23 e1j) but should calculate directions by referencing an address in a second cell (again, given as a UK postcode).

    I imagine this will default to driving directions, but if at all possible it would be a big bonus to repeat the link with a change in transport mode, so I could directly open google directions with the transit/bicycle options already selected.

    nb.
    I have already successfully linked to a google map to a location specified in a cell by following steps in someone else's post (as follows). So this is really a follow-on from that discussion. thank you.

    http://www.excelforum.com/excel-form...readsheet.html

    Tom

    EDIT: (30 mins later)
    I have reviewed numerous threads on this and youtube uploads. For anyone interested here's a youtube demo of how to create a link to directions: https://www.youtube.com/watch?v=tfFrwK8ezQc

    I haven't yet found any way to set this to Bicycling or Transit modes, however, and this would still be extremely helpful if someone knows.
    thanks
    Last edited by texcel_tom; 11-24-2016 at 06:12 PM. Reason: issue now partially solved

  2. #2
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: creating a link from a set location to a location specified in another cell (googlemap

    Here's how I've done it.
    In A1 to A3, I have 'Postcode From', 'Postcode to' and 'Mode of Travel'.
    I put the 'from' postcode into B1 and 'to' postcode in B2. Then I put a table in A6:B10 containing the following, for modes of transport:
    Please Login or Register  to view this content.
    In B3, I set up Data Validation to give a drop-down list of 'Driving / Cycling / Walking / Public Transport / Flying' - i.e. from A6:A10.

    Then I use this formula to give me the link to Google maps:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Now you can select your mode of transport and the link will give you what you choose.

    You can add a 'via' by adding another cell and adding another "&SUBSTITUTE(B1," ","")&"/" section to the formula, e.g. this would work with the 'from' in B13, 'via' in B14, 'to' in B15 and 'mode' in B16:
    =HYPERLINK("https://www.google.co.uk/maps/dir/"&SUBSTITUTE(B13," ","")&"/"&SUBSTITUTE(B14," ","")&"/"&SUBSTITUTE(B15," ","")&"/"&VLOOKUP(B16,$A$6:$B$10,2,FALSE))
    If the 'via' is blank, Google will ignore it.

    I've attached a file with the above working. Hope that helps.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  3. #3
    Registered User
    Join Date
    01-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2016
    Posts
    15

    Re: creating a link from a set location to a location specified in another cell (googlemap

    hello Aardigspook

    thanks so much for this. I'll look closely when I get a chance later today.

    I would still prefer to have a column dedicated to each transport mode, but I'll try and adapt what you've given for that.
    thank you again.

    Tom

  4. #4
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: creating a link from a set location to a location specified in another cell (googlemap

    Ok. With 'Postcode from' in B1, 'via' in B2 and 'to' in B3 (as noted above, if the 'via' is blank, Google will ignore it), use the following:

    Driving
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Cycling
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Walking
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Public Transport
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Flying
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If you want the link to have a 'friendly name' just put that before the last bracket, like this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The attached sheet shows these working - in rows rather than the columns you asked for, but that's just so you can see the links more easily - you can move them around as you wish.
    Hope that does what you want.

  5. #5
    Registered User
    Join Date
    01-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2016
    Posts
    15

    Re: creating a link from a set location to a location specified in another cell (googlemap

    hi Aardigspook

    that, really, is a huge help!

    can't say thanks enough - excel defeated me on this but is now running like a finely-tuned engine

    I used the formulae from your attached sheet in the end, for some reason the links posted above did not produce active (i.e. blue, clickable) hyperlinks. I guess this was perhaps this was due to some invisible formatting error at my end.

    thank you again, as previously with the forum I've been humbled by the efforts taken
    cheers

    Tom

  6. #6
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: creating a link from a set location to a location specified in another cell (googlemap

    Glad to have helped - thanks for the feedback.

    For future reference, if you copy a link formula from above into the formula bar instead of pasting it directly into a cell, it'll become clickable. If you paste it into a cell and it stays black & unclickable, then just go to the formula bar (click in it or press F2) then press Return to make it a proper hyperlink.

    If that's your problem solved, please mark the thread as Solved to let others know that there's a solution here (instructions in my sig). Thanks.

  7. #7
    Registered User
    Join Date
    01-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2016
    Posts
    15

    Re: creating a link from a set location to a location specified in another cell (googlemap

    Right - re hyperlinks, ok, yes that's it. Bit rusty, thanks for the tip.
    have now marked as resolved.

    Tom

+ 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. Link Form Control Button to Cell Location?
    By bennetas in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-22-2016, 07:48 AM
  2. Reference a cell as part of a file location in a link
    By rudderless1975 in forum Excel General
    Replies: 1
    Last Post: 10-02-2013, 09:57 AM
  3. [SOLVED] [Help]macro to open file browser, to select a location, and save the location to a cell
    By zhuleijia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-06-2013, 09:56 AM
  4. Store current cell location to use same location on other worksheet
    By jmvdholst in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2013, 09:58 AM
  5. open link in cell; save pdf in a different location
    By rkiser in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2012, 06:56 PM
  6. Is it possible to read a form button location or cell link?
    By ifwhitfi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-15-2012, 04:45 PM
  7. Creating variables based on cell location
    By length in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-11-2009, 01:10 PM
  8. link location defined in 1 cell help
    By bkshoop in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-21-2005, 02:53 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