+ Reply to Thread
Results 1 to 19 of 19

Strange HYPERLINK() behaviour...

  1. #1
    Registered User
    Join Date
    06-12-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel for Mac, v.16.37
    Posts
    10

    Strange HYPERLINK() behaviour...

    Hi,

    I am using the HYPERLINK() function to make clickable links to external PDFs. My hyperlinks are composed as follows:

    =HYPERLINK("[filepath head]"&[CELL REF]&".pdf","Click here")

    where the CELL REF is to an adjacent cell that contains the PDF's filename as a string (but without the suffix, which is why I am adding it in the formula).

    The hyperlinks work - there is nothing wrong with the formula - but they don't work until I do something that seems unrelated first. A hyperlink constructed with the above formula will return a "Cannot open the specified file" alert, unless I create a direct hyperlink to the same pdf in another cell and open it once. Then my HYPERLINK() cell will open the file correctly, even though I have changed nothing in the formula?!?

    I really don't understand why this is happening, and as my hyperlinks will be created dynamically, I can't go and create a direct link next to each one as a work around.

    Any ideas why this would be occurring and how I might solve it would be greatly appreciated.

    Thanks
    Last edited by cjh17000; 06-12-2020 at 01:05 AM.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Strange HYPERLINK() behaviour...

    Does the [CELL REF] contain the partial name of pdf?
    I suggest to replace it with:
    INDIRECT([CELL REF])
    Quang PT

  3. #3
    Registered User
    Join Date
    06-12-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel for Mac, v.16.37
    Posts
    10

    Re: Strange HYPERLINK() behaviour...

    Hi bebo021999,

    No, that doesn't work, I'm afraid. Same problem.
    Last edited by cjh17000; 06-12-2020 at 01:02 AM.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: Strange HYPERLINK() behaviour...

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Registered User
    Join Date
    06-12-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel for Mac, v.16.37
    Posts
    10

    Re: Strange HYPERLINK() behaviour...

    Hi AliG,

    I haven't attached a sample workbook because my links are referencing external files...

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: Strange HYPERLINK() behaviour...

    That doesn't matter - I want to see exactly what you've done.

    Just to clarify - experience with these things tells me that this will be something very small and peculiar to the way you have set up the worksheet, and probably not something we will be able to spot from your descriptions. Happy to have a look, but it's up to you.
    Last edited by AliGW; 06-12-2020 at 01:23 AM.

  7. #7
    Registered User
    Join Date
    06-12-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel for Mac, v.16.37
    Posts
    10

    Re: Strange HYPERLINK() behaviour...

    I have attached a sample sheet. It has 2 columns of links. Column B has the links composed with "&", column C has the links composed using CONCATENATE(). Neither of those solutions is working first time. I have to manually open the link, as described first...
    Attached Files Attached Files
    Last edited by cjh17000; 06-12-2020 at 01:43 AM.

  8. #8
    Registered User
    Join Date
    06-12-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel for Mac, v.16.37
    Posts
    10

    Re: Strange HYPERLINK() behaviour...

    [This message deleted]
    Last edited by cjh17000; 06-12-2020 at 01:37 AM.

  9. #9
    Registered User
    Join Date
    06-12-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel for Mac, v.16.37
    Posts
    10

    Re: Strange HYPERLINK() behaviour...

    Hey Ali, yes indeed, it's often the way. If the formula wasn't working at all, I probably wouldn't have ended up here, but the behaviour I am seeing I just don't understand at all. I have attached a sample sheet below (or possibly above...)

  10. #10
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Strange HYPERLINK() behaviour...

    In column "A" Enter your file name suppose "A2"
    In column "B" Enter Path suppose "B2"
    In column "C" :
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: Strange HYPERLINK() behaviour...

    Try this:

    =HYPERLINK("Enclosing folder\"&A1&".pdf","LINK")

    Change the forward slash to a backslash.

  12. #12
    Registered User
    Join Date
    06-12-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel for Mac, v.16.37
    Posts
    10

    Re: Strange HYPERLINK() behaviour...

    Hi Atul,

    The only difference between your solution and mine is that you are using an absolute file path. My workbook and the PDFs are in the same directory, so I was using relative paths. Do you think the relative paths are the problem?

  13. #13
    Registered User
    Join Date
    06-12-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel for Mac, v.16.37
    Posts
    10

    Re: Strange HYPERLINK() behaviour...

    Hey Ali,

    No, that doesn't help. I had already tried that in fact. I still get the same error, until I have opened the link once using a direct hyperlink, and then subsequently the formula cell works...

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: Strange HYPERLINK() behaviour...

    The relative paths are the problem - you need full filepaths similar to this:

    =HYPERLINK("C:\Users\Alison\Documents\"&A1&".pdf","LINK")

  15. #15
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Strange HYPERLINK() behaviour...

    Can you try with as per Ali say's "Change the forward slash to a backslash."

  16. #16
    Registered User
    Join Date
    06-12-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel for Mac, v.16.37
    Posts
    10

    Re: Strange HYPERLINK() behaviour...

    OK, sorry for the hiatus. Travelling. I am trying to use relative paths because the workbook is a shared resource, shared via dropbox and accessed by Macs. I am not sure that the local Dropbox folder is saved in the same place on all the machines that will be accessing this file, so absolute paths are not a solution. I don't see why relative paths should be problematic?

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: Strange HYPERLINK() behaviour...

    This discussion suggests that relative paths should work as long as they remain unchanged: https://www.ablebits.com/office-addi...link-function/

    You have now mentioned DropBox.

    It might be wirth reading the description of the workings of a relative file path here: https://www.excelfunctions.net/excel...-function.html

    Does this explain your anomalies?

  18. #18
    Registered User
    Join Date
    06-12-2020
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel for Mac, v.16.37
    Posts
    10

    Re: Strange HYPERLINK() behaviour...

    Hi Ali. Thanks for staying with me. No, these links don't contain any info I didn't already know. I think the issue has to be with DropBox and how it constructs file paths. I have placed a query on the DropBox user Community Forum.

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,779

    Re: Strange HYPERLINK() behaviour...

    I think that best. Let us know what you find out.

+ 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. [SOLVED] CLng strange behaviour
    By ziomocci in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-08-2017, 04:16 AM
  2. [SOLVED] strange behaviour from vba
    By harryv27 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-14-2016, 04:50 AM
  3. [SOLVED] XIRR strange behaviour
    By phe in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2013, 01:51 AM
  4. Strange Behaviour
    By Mark@Work in forum Excel General
    Replies: 2
    Last Post: 09-30-2008, 12:22 PM
  5. [SOLVED] Strange if(***) behaviour?
    By Excel 2003 - SPB in forum Excel General
    Replies: 6
    Last Post: 08-06-2006, 12:35 PM
  6. [SOLVED] Strange VBA Behaviour
    By Ricko in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-28-2005, 03:05 AM
  7. [SOLVED] Strange behaviour
    By Edgar Thoemmes in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-08-2005, 12:06 PM

Tags for this Thread

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