Creating a Dynamic Hyperlink

by Allen Wyatt
(last updated December 8, 2017)


Mark wonders how to create a hyperlink to a worksheet in the same workbook. The name of the worksheet will change, so he thinks the link will have to be "dynamic." He would also like the "friendly name" for the hyperlink to change with the worksheet name.

There are a few ways that this can be approached. The first is to create a simple hyperlink to the destination using the HYPERLINK function. The syntax for the function is as follows:

=HYPERLINK(link_location, [friendly_name])

Note that the second paramaeter (the friendly name) is optional, but should be used in Mark's scenario. If you want to link to another worksheet, then all you need to do is provide the address of a cell on that worksheet, in this manner:

=HYPERLINK("[myWorkBook.xlsx]MySheet!A1", "Jump There")

This provides a hyperlink to cell A1 on the worksheet named "MySheet." This works great, provided that there is no name change to "MySheet." If the name is changed or if the referenced cell is deleted, then the hyperlink no longer works.

There is an easy way to get around this potential problem, but it introduces a new potential problem. Yu can create a named range on the destination worksheet, and then use the named range in the HYPERLINK function, in this manner:

=HYPERLINK("#MyRange","Jump There")

Note that the range name must be preceded by a # sign and enclosed in quotes. Clicking the link displays whatever worksheet contains the named range and selects that range. It is more versatile than the earlier approach because it doesn't matter if you rename the worksheet containing the named range. It does matter, however, if the named range is deleted. (If only a part of the named range is deleted, Excel adjusts fine. It only balks if the entire named range is deleted.)

To get around all of these problems requires the user of helper cells. (You could also use a simple macro or two, but that may be overkill for Mark's needs.) As an example, put the following into cell A24:


The cell will show whatever is in cell A1 on MySheet. If you later change the name of MySheet (the actual sheet name), then the formula automatically changes. If you insert or delete rows or columns in MySheet, the reference to cell A1 in the formula won't change. This allows you to always have a valid worksheet and cell reference. In order to get that reference into a form that you can use in the HYPERLINK function, place the following formula in cell B24:


The FORMULATEXT function converts the formula in cell A24 into a text string and the addition of the MID function pulls off the equal sign from the front of the formula. The formula, as shown, allows for very long worksheet names, up to 96 characters (the other three characters are "!A1"). You can then use the following formula to create the actual hyperlink:

=HYPERLINK("[myWorkBook.xlsx]" & B24, "Jump There")

The hyperlink target is always dynamic and stable, which is exactly what is needed. It should be noted, though, that the FORMULATEXT function was introduced in Excel 2013; it won't work in earlier versions of the program.

I haven't spent much time talking about the friendly name portion of the HYPERLINK function. That's because you could easily change it to reference just about anything you want. You could, for instance, have it reference a different cell which, in turn, displays a value based on whatever formula you desire:


This example grabs the friendly name from whatever is in cell A7. Change what is in cell A7, and the friendly name updates at the same time.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13034) applies to Microsoft Excel 2007, 2010, and 2013.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...


Changing Built-in Word Commands

Want to replace Word's internal commands with your own macros? It's easy to do if you know the key discussed in this tip.

Discover More

Automatically Sorting as You Enter Information

When entering information into a worksheet, you may want it to always be in a correctly sorted order. Excel allows you to ...

Discover More

Recognizing a Header Row when Sorting

When you sort data in a worksheet, there are a couple ways you can do it. Using the simple way can result in unsatisfactory ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Extracting Hyperlink Information

In Excel, a hyperlink consists of two parts: the text displayed for the link and the target of the link. You can use a macro ...

Discover More

Sending an E-mail when a Due Date is Reached

Wouldn't it be great if Excel could automatically e-mail you when a due date is reached? It can, if you are using Outlook and ...

Discover More

Converting to Hyperlinks in a Shared Workbook

When you enter a URL or e-mail address in a worksheet, Excel usually converts it to a clickable hyperlink. This doesn't ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 3 - 2?

2017-12-08 11:50:54


Don, for your example, I was able to retrieve the filename using this formula: =MID(FORMULATEXT(A62),48,(LEN(FORMULATEXT(A62))-57))

2017-12-08 11:40:53


Thanks Allen and Bryan, fun stuff! There is a small typo in Allen's 5th formula...=MID(FORMULATEXT(A24),99) should be =MID(FORMULATEXT(A24),2,99).

2017-12-08 11:27:39

Don Hornbrook

In my home bookkeeping system, I scan a copy of each credit card receipt and then add a Hyperlink reference at the end of each line:

My working hyperlink formula looks like this:

=HYPERLINK("c:\users\CurrentDocs\2017 Receipts\WholeFoods_171201.pdf","Image")

At year end, when I archive the entries, I don’t want to preserve the entire Hyperlink formula, but only the filename, in this case: WholeFoods_171201.pdf

I thought a simple Mid() formula would do the trick, something like Mid(R215,63,(LEN(R215)-72)), but the formula operates on the Displayed Text in the cell (“Image”) and not the hyperlink formula itself.

I thought I’d try to write a UDF that stripped out all but the filename reference, but my understanding of how to pass range or cell references to a Function seems to be lacking.

I was successful in writing a Sub that places a single quote in front of the formula in the next column to the right:

Sub ShowHyperlink()
ActiveCell.Offset(0, -1) = "'" & ActiveCell.Offset(0, -1).Formula
End Sub

and then I wrote the Mid() formula in the next column, but that takes two steps and two columns, and I would like to do everything with a UDF in a single step, something like: =ShowFileName(S215).

Can this be done in a UDF?

2016-10-07 04:27:21


Great, thank you, Allen!

2016-07-17 05:23:35


How do we create a dynamic hyperlink to a cell value so that on click of that value focus should jump to this value in single worksheet where its details are present

2016-01-25 22:55:50

Sourin Sett

i was wondering how to create dynamic hyperlink to a particular cell of another xlsx file in the same folder?

2016-01-25 17:24:39


I was wondering if you knew a way to incorporate this into a hyperlink to open another seperate workbook/spreadsheet to a named range.

~ Thx.

2016-01-20 06:32:52


"This tip (13034) applies to Microsoft Excel 2007, 2010, and 2013."

FORMULATEXT is worksheet function in Excel 2013+

2016-01-19 05:36:56

Sukhpal Singh

Hi Allen,

I am having trouble figuring out why after putting multiple hyperlinks in a worksheet, it continues to re-direct me to the latest hyperlink i have created- the same link for each different link.

I would grateful if you can advise me.

Thank you.

2015-09-21 14:12:40


how can i create a hyperlink to sheet by referencing a cell value? my main sheet column A has index numbers 1, 2, 3 etc. My sheets are named 1, 2, 3 etc.

2015-09-10 02:59:10

Jeff Brown


Is there a hyperlink formula i can use that will open either a JPG or PNG file.

my current formula is;
=HYPERLINK(CONCATENATE("T:MarketingCosting TemplateImages",F5,"",D5,".jpg"),"View")

obviously this will only open the .jpg file. how do i adjust this so it can open the file regardless of whether it is saved in JPG or PNG format?


2015-07-13 01:16:14


I want to do a statement in excel and want to put a specific cell reference in between the statement, is it possible if yes how

2015-04-02 20:29:04


I have solved the problem i posed a couple of days ago. I am embarrassed as to how simple it was.
If anyone is interested...

=Hyperlink(index(Array,Row,Column)) and manipulating the second and third arguments by calculation. I.e the row or column can become a constant depending what you wish to achieve.

2015-04-01 22:21:16


I have been using the following hyperlink for a long time now without any problems. However, I now wish to reference a row; rather than a column and then calculate the column number instead of the row number.
Present dynamic hyperlink:
Destination: is column C at row number specified in cell Z9.

Can you help?

2014-10-02 00:48:35


I want to make a formula where I provide a web site and it's dynamic variable like this:
Sample cell A1. Value 12345[A1]

the result must be an internet clickable hyperlink on the spreadsheet like this:


2014-03-28 07:02:13


Don: I agree that deletions shouldn't be an issue for the developer -- they should cause just as much trouble with any of these formulas than they would with anything else.

And ooops! Thanks for catching the typo. You managed to expose a secret about how I develop formulas: I break them into multiple cells, then combine them at the end.

2014-03-27 15:23:18


Let me start by saying I learned a load from this tip, both the original from Allen and feedback from Bryan. When I saw the request from Mark I got stuck at the problems in using the Insert Hyperlink function in the UI, and reverted to thinking about VBA and workbook/worksheet events.

In my mind this is the kind of feature that would be built near the end of the development cycle, after formulas and headers and the input cells are all defined it seems like the likelihood of the deletion of target ranges would be slight, i.e. the developer would know what ranges would be in danger of deletion and protect the target ranges before release to the users.

There is one typo in Bryan's formula: an extra equal sign in the middle. Otherwise, it worked beautifully with just a copy/paste and editing for the name of the worksheet.

2014-03-24 09:27:14


1) You've got a typo in the 5th paragraph ("Yu instead of "You").

2) Helper cells don't get around "all of these problems" -- there's no solution to the "linking to a deleted cell" problem. The only way to get around this problem would be to have your cell reference as A1:XFD1048576... which still will throw an error if you delete all the cells in the sheet.

3) If you use the CELL function, you don't need to use the multi-helper-cell solution: =HYPERLINK(CELL("address",MySheet!A1), "Jump There")

4) The problem statement sounds like Mark wants the friendly name to be the target worksheet name, so the entire formula would be: =HYPERLINK(CELL("address",MySheet!A1), =LEFT(MID(CELL("address",MySheet!A1),FIND("]",CELL("address",MySheet!A1))+1,9^9),FIND("!",CELL("address",MySheet!A1))-FIND("]",CELL("address",MySheet!A1))-1))

4a) My formula in step 4 is a good candidate for helper cells/named ranges, since the same calculation is done repeatedly. Using named ranges, the formula would be: =HYPERLINK(wkst_address,wkst_name)


wkst_address = CELL("address",MySheet!A1)

wkst_name = MID(wkst_address,l_pos,r_pos-l_pos)

l_pos = FIND("]",wkst_address)+1

r_pos = FIND("!",wkst_address)

2014-03-24 09:10:59


Awesome! THANKS Allen!

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.