SOLVED

File name, referenced in a hyperlink, located in a different cell

Brass Contributor

I would like to create a fixed hyperlink in cell I5 in a worksheet named ABC.

I would like this hyperlink to reference cell B5 in a worksheet within a separate directory. This file is named 20210830ABC.

 

The file name for file 20210830ABC will change daily, as it is based on YEAR|MONTH|DAY. Tomorrow, it will be named 20210831ABC. I do not want to have to update the hyperlinks on worksheet ABC every day.

 

Within worksheet ABC, I would like to have cell J11 indicate the name of the file that the hyperlink should reference. As file 20210830ABC is subject to change to 20210831ABC, the link in cell I5 will not work unless the file name within this cell is updated. 

 

So instead of cell I5 on worksheet ABC referencing \\server\directory\filename\B5...

It would reference \\server\directory\"CELL J11"\cell B5.

 

If this is possible, how do I edit the hyperlinks so they use the text in a cell as part of the location of the linked file?

7 Replies

=HYPERLINK(ADDRESS&FILENAME)
=HYPERLINK("\\server\directory\"&J11)

To retrieve the value inside the file it needs to be opened to work using the INDIRECT formula

=INDIRECT("'"&ADDRESS&"["&FILENAME&"]Sheet1'!$B$5")

 

=HYPERLINK("\\server\directory\"&J11,INDIRECT("'"&"\\server\directory\"&"["&J1&"]Sheet1'!$B$5"))

 

The INDIRECT formula works but the file must be opened.

I appreciate the response but I am unclear. Do I paste this string into cell I5?

=HYPERLINK("\\server\directory\"&J11,INDIRECT("'"&"\\server\directory\"&"["&J1&"]Sheet1'!$B$5"))

If so, do I remove any of the quotes? It isn't working. Thanks.

@Danger_SF 

 

Please give feedbacks if the solution meets your needs

best response confirmed by Danger_SF (Brass Contributor)
Solution
Thank you. I added a \ to the end of the file path in your example and that worked. Great support! I appreciate the help very much.
Any timemy friend. Please just hit the Like Button and flag it as solved.
Ok, now this is odd. Maybe you can help.

2 days ago, I created these hyperlinks on file #1. Yesterday in the morning I opened file #1 and file #2 and the hyperlink directing to file #2 was broken. The same afternoon I opened the two files and the hyperlink worked. ???

What outside influences could affect file #1's ability to access data in file #2? Both files are located within the same parent directory on a shared drive. It wouldn't be a security policy since it worked twice and failed to work twice. Maybe add-ons?
Update:

As we all know, hyperlinks to shared files only work when both files are open. My problem occurs when I open both files via my Windows Explorer shortcut on my PC.

When I use Excel (File #1) to access the directory to open the linked file (File #2), the hyperlink works. What I mean by that is that I have the file path for the linked directory (which houses File #2) written out in the worksheet of File #1. When I click on that text, Excel causes Windows Explorer to open. When I open the file from that window, the hyperlink works.

I don't understand why that works, but if that helps anyone else to understand a setting in Excel or in Windows that is keeping the hyperlink from working otherwise, I'd be interested in understanding.
1 best response

Accepted Solutions
best response confirmed by Danger_SF (Brass Contributor)
Solution
Thank you. I added a \ to the end of the file path in your example and that worked. Great support! I appreciate the help very much.

View solution in original post