Excel HYPERLINK Function

Function Description

The Excel Hyperlink function creates a hyperlink to a specified location.

The syntax of the function is:

HYPERLINK( link_location, [friendly_name] )

where the arguments are as follows:

link_location - The address to link to.
[friendly_name] -

An optional argument that provides the text to display in the Excel cell.

If the [friendly_name] argument is omitted, the link_location text is displayed in the cell.


The address supplied for the link_location argument can be an absolute reference or a relative reference. The difference between these two reference types is shown in the table below.

Absolute Reference

Shows the entire path to the referenced file.

E.g.

C:\Documents and Settings\User1\ExcelFile1.xlsx

Relative Reference

Refers to the referenced file's location relative to the current directory.

E.g. if the current Excel file is located in C:\Documents and Settings, then the relative reference:

User1\ExcelFile1.xlsx

is equivalent to the absolute reference:

C:\Documents and Settings\User1\ExcelFile1.xlsx

Also, within a relative reference, ..\ is used to specify the directory above the current one.

E.g. if the current Excel file is located in C:\Documents and Settings, then the relative reference:

..\ExcelFile1.xlsx

means "move up one directory and from there, access the file ExcelFile1.xlsx"

This is equivalent to the absolute reference:

C:\ExcelFile1.xlsx

Hyperlink Function Examples

Excel Hyperlinks are an excellent way of organising your data. This is shown in the spreadsheet below, which collates details of sales invoices, and uses the Excel Hyperlink function to create links to individual invoices:

Formulas:

  A B
1 Date Invoice Link
2 05-Jan-17 =HYPERLINK( "C:\Invoices\Invoice_B001.pdf", "B001" )
3 06-Jan-17 =HYPERLINK( "Invoice_B002.pdf", "B002" )
4  

Results:

  A B
1 Date Invoice Link
2 05-Jan-17
3 06-Jan-17
4    

Note that, in the above example, the hyperlink in cell B2 uses an absolute reference, while the hyperlink in cell B3 uses a relative reference.

As the current spreadsheet is located in the directory C:\Invoices, the hyperlink functions in cells B2 and B3, create links to the files Invoice_B001.pdf and Invoice_B002.pdf, both of which are located in the directory C:\Invoices.


For further details and examples of the Excel Hyperlink Function, see the Microsoft Office website.