How to use the HYPERLINK function
What is the HYPERLINK function?
The HYPERLINK function allows you to build a link in a cell pointing to something else like a file, workbook, cell, cell range, or webpage.
You can then press with left mouse button on that link to open a file or quickly navigate to a location in a workbook.
Table of Contents
- Excel function syntax
- Function arguments
- How to select a cell containing a hyperlink?
- HYPERLINK function not working
- How to create a link to a cell
- How to create a link to a cell range
- How to create a link to another worksheet
- How to create a link to a workbook
- How to create a link to a named range
- How to create a link to an Excel Table
- How to create a link to a file
- How to create a link to a webpage
- How to create a link based on cell value
- Get Excel file
1. Excel function syntax
HYPERLINK(link_location, [friendly_name])
2. Arguments
Link_location | Required. Depending on what you want to create a link to you have these options:
|
friendly_name | Optional. A value or a cell reference used by the HYPERLINK function to show link text, in the cell. This argument is optional, the HYPERLINK function displays the link location if the argument is missing. |
3. How to select a cell containing a hyperlink?
To select a cell without performing the hyperlink action press and hold on the cell until a cross appears, see the animated image above.
4. HYPERLINK function not working
The HYPERLINK functions first argument is not easy to type, there are a few things to remember:
- full path if the workbook or file is not in the same directory as the active workbook
- workbook name with leading and trailing bracket
- worksheet name with leading and trailing single quote if the name contains a space character
- exclamation mark between worksheet name and cell address
Below are common errors described.
4.1 Reference isn't valid error
The image above shows an error that Excel returns if the worksheet name is missing or the worksheet name contains space characters.
HYPERLINK(link_location, [friendly_name])
The link_location argument must contain a reference to the workbook name, worksheet name, exclamation mark between worksheet name and cell address, and a cell address if you want to link to an item in a workbook.
Formula in cell B3 that returns an error:
Worksheet reference "Link to a cell" above contains space characters, use a leading and trailing single quote or apostrophe to avoid the "Reference isn't valid" error.
Formula in cell B3 that works:
4.2 Cannot open the specified file error
The image above demonstrates an error that is returned if the workbook name is missing in the link_location argument.
HYPERLINK(link_location, [friendly_name])
Formula in cell B3 that returns an error:
The link_location argument above doesn't contain a reference to the workbook name, use leading and trailing brackets to avoid "Cannot open the specified file" error.
Formula in cell B3 that works:
4.3 Excel found a problem with one or more formula references in this worksheet
The image above shows an Excel error if the first argument in the HYPERLINK function is not correct.
The dialog box shows "Excel found a problem with one or more formula references in this worksheet. Check that the cell references, range names, defined names, and links to other workbooks in your formulas are all correct.
Formula in cell B3 that returns an error:
The link_location argument above doesn't contain a reference to a cell.
Formula in cell B3 that works:
5. How to create a link to a cell
The image above demonstrates how to link to a specific cell using the HYPERLINK function.
Formula in cell B3:
HYPERLINK(link_location, [friendly_name])
The link_location argument must contain a reference to the workbook, worksheet, and cell address. [friendly_name] argument lets you specify the hyperlink text to show in the cell.
Note the exclamation mark between the worksheet and cell address.
6. How to create a link to a cell range
The image above demonstrates how to link to a specific cell range using the HYPERLINK function. The cell range is selected if you press with left mouse button on the hyperlink.
Formula in cell B3:
HYPERLINK(link_location, [friendly_name])
The link_location argument must contain a reference to the workbook, worksheet, and a reference to a cell range. [friendly_name] argument lets you specify the hyperlink text to show in the cell.
Note the exclamation mark between the worksheet and cell address.
7. How to create a link to another worksheet
The image above demonstrates how to link to a specific worksheet using the HYPERLINK function.
Formula in cell B3:
HYPERLINK(link_location, [friendly_name])
8. How to create a link to a workbook
The image above demonstrates how to link to a specific workbook using the HYPERLINK function.
Formula in cell B3:
HYPERLINK(link_location, [friendly_name])
Note that a reference to the workbook name only is valid. Remember to reference the full path if the workbook is not in the same directory.
=HYPERLINK("[TEXT function.xlsx]","Link to Text function.xlsx")
9. How to create a link to a named range
The image above demonstrates how to link to a specific named range using the HYPERLINK function.
Formula in cell B3:
HYPERLINK(link_location, [friendly_name])
You need to specify the path, workbook name, and the name of the named range, the example above has no path specified. The workbook is in the same folder as the active workbook.
Read more about named ranges: Define and use names in formulas
10. How to create a link to an Excel Table
The image above demonstrates how to link to a specific named range using the HYPERLINK function.
Formula in cell B3:
HYPERLINK(link_location, [friendly_name])
You need to specify the path, workbook name, and the name of the Excel Table. The example above has no path specified, the workbook is in the same folder as the active workbook.
Read more about Excel Tables
11. How to create a link to a file
The image above shows how to link to a specific file using the HYPERLINK function.
Formula in cell B3:
HYPERLINK(link_location, [friendly_name])
You need to specify the path, file name, and file extension. The example above links to a pdf file named temp.pdf in a temp folder on harddrive c:\.
12. How to create a link to a webpage
The image above shows how to link to a specific website using the HYPERLINK function.
Formula in cell B3:
HYPERLINK(link_location, [friendly_name])
You need to specify the url to the website you want to link. The example above links to Google.
13. How to create a link based on cell value
If you use a cell reference as an argument you can make the function dynamic. This allows the HYPERLINK function to change depending on the value in the cell that the cell reference points to.
Formula in cell D3:
You can create formulas that lookup a value and return a link to that value using this technique.
Here are some articles:
Locate lookup values in an Excel table [HYPERLINK]
Navigate to first empty cell using a hyperlink formula
Create a hyperlink linked to the result of a two-dimensional lookup
How to quickly find the maximum or minimum value [Formula]
Useful resources
HYPERLINK function - Microsoft support
'HYPERLINK' function examples
The image above shows a formula in cell C2 that searches for a value based on two conditions specified in […]
The image above shows two hyperlinks, the first hyperlink lets you select a data set automatically based on a dynamic […]
This article demonstrates formulas that return the last value in a given cell range or column. The image above shows […]
Functions in 'Lookup and reference' category
The HYPERLINK function function is one of many functions in the 'Lookup and reference' category.
Excel function categories
Excel categories
One Response to “How to use the HYPERLINK function”
Leave a Reply
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Oscar,
What is the best way to get around the characters limit when using HYPERLINK? Thanks