Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Special Characters In Hyperlinks.

Special Characters In Hyperlinks

Written by Allen Wyatt (last updated February 22, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and 2021


4

You probably already know that Excel allows you to create hyperlinks to other Excel workbooks. If you create a workbook that uses the pound sign (#) in the file name, Excel has no problem with that. It will have a problem, however, if you try to create a hyperlink that references a workbook with a pound sign in the file name.

The reason for this is because the pound sign is a valid character for a file name, but it is not a valid character for use in a hyperlink. Since hyperlinks are closely related to URLs, you may think that replacing the pound sign with its hexadecimal equivalent (%23) in the hyperlink might do the trick. For instance, you might use the name My%23File.xlsx in the hyperlink instead of My#File.xlsx. This potential solution won't work, however. Excel still complains that it cannot find the file when you click on the hyperlink.

According to Microsoft sources, there are only two potential solutions. The first is to rename the target workbook so it doesn't include the pound sign in the file name. If this is not possible, then the second solution is to create a hyperlink by pasting instead of by using the Insert Hyperlink command. Follow these steps:

  1. Open the workbook in which you want the hyperlink.
  2. Open the target workbook.
  3. In the target workbook, select the cell or range of cells you want selected when the hyperlink is clicked.
  4. Press Ctrl+C to copy the cell or range of cells to the Clipboard.
  5. Activate the workbook in which you want the hyperlink.
  6. Select the cell where you want the hyperlink to appear.
  7. Display the Home tab of the ribbon.
  8. Click the down-arrow under the Paste tool and then choose Paste Link. (Depending on your version of Excel, you may need to choose Paste Special before you can see a Paste Link option.)

Your hyperlink appears, complete with the pound sign, and it will work.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12572) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and 2021. You can find a version of this tip for the older menu interface of Excel here: Special Characters In Hyperlinks.

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. ...

MORE FROM ALLEN

Returning the MODE of a Range

The MODE function is used to determine the most frequently recurring value in a range. This tip explains how to use the ...

Discover More

Stopping Automatic Changes from Being Tracked

Track Changes is a great feature for keeping track of what gets changed in a document. There are some things (such as ...

Discover More

Finding an Invisible Text Box

Text boxes can be a great aid in designing the layout of your document. What do you do when you can't find a text box ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 365 applications with VBA programming. Written in clear terms and understandable language, the book includes systematic tutorials and contains both intermediate and advanced content for experienced VB developers. Designed to be comprehensive, the book addresses not just one Office application, but the entire Office suite. Check out Mastering VBA for Microsoft Office 365 today!

More ExcelTips (ribbon)

Converting a Range of URLs to Hyperlinks

Converting a single URL into a hyperlink is easy. Converting hundreds or thousands can be much harder if you have to rely ...

Discover More

Links to Hyperlinks

Hyperlinks in a worksheet can be helpful or essential, depending on the nature of your data. If you create a link to a ...

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 ...

Discover More
Subscribe

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

View most recent newsletter.

Comments

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}] (all 7 characters, in the sequence shown) 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 5 - 3?

2025-05-06 13:02:30

Kiwerry

I have also had problems with the HYPERLINK function, but in my case they were caused by some characters (e.g. space, or minus ) in sheet names. As J. Woolley pointed out below, the problem can be solved by enclosing the sheet name in ' characters.


2022-04-13 13:00:05

J. Woolley

I guess newer versions of Excel have (partially) addressed this issue. To open My#File.xlsx with an Excel Ctrl+K hyperlink, enter the following Address:
My%23File.xlsx
but do NOT enter the following Address:
[My%23File.xlsx]
You can also use the HYPERLINK function with either link_location:
=HYPERLINK("My%23File.xlsx")
=HYPERLINK("[My%23File.xlsx]")
Square brackets are useful (but unnecessary) if the filename has special characters like space, exclamation, or apostrophe (but not hash).
The Tip fails to explain why Excel treats hash (#) as a special character in hyperlinks. It is used to separate Hyperlink.Address from Hyperlink.Subaddress, where the first references an Excel workbook and the second references a cell or a range or a name or a worksheet plus a cell or a range or a name. The HYPERLINK function does not create a Hyperlink object, but the following examples apply:
=HYPERLINK("My%23File.xlsx#A1")
=HYPERLINK("My%23File.xlsx#A1:B2")
=HYPERLINK("My%23File.xlsx#MyName")
=HYPERLINK("My%23File.xlsx#'Sheet1'!A1")
=HYPERLINK("My%23File.xlsx#'Sheet1'!A1:B2")
=HYPERLINK("My%23File.xlsx#'Sheet1'!MyName")
Apostrophes are necessary only if the worksheet name has special characters like hash, space, exclamation, apostrophe (must double like 'Sheet''1'), or quotation (must double like 'Sheet""1' if within quoted text).
The hash character can also be used in a hyperlink to open an Excel VBA procedure in the Visual Basic Editor (VBE):
=HYPERLINK("?#MyProc")
Or to run a VBA procedure:
=HYPERLINK("?#MyFunc(2*3.14)")
The question mark (?) character references the current workbook. MyFunc must be a Function returning Range:

Function MyFunc(arg) as range
...
Set MyFunc = Selection
Exit Function

My Excel Toolbox includes the SuperLink function (a superior substitute for HYPERLINK) and the UseSuperLink.pdf document.
See https://sites.google.com/view/MyExcelToolbox


2022-04-12 14:08:32

Christian

Thank you for the tip. Much appreciated.


2018-03-17 23:11:25

Alex B

Its is just bizarre that with an identical Hyperlink dialogue box in MS Outlook and MS Excel, the # works in Outlook but not in Excel.

I have found one other way of doing this.
Using the Hyperlink formula, adding file:/// to the front and replacing the # with the %23

=HYPERLINK("file:///C:\Users\USERNAME\Documents\My%23File.xlsx","My#File")




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
Subscribe

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.