How to Extract URL from Hyperlink in Excel (3 Simple Ways)

Table of Contents

Table of Contents

Working with Excel often involves managing hyperlinks embedded in cells. These hyperlinks usually display friendly text but link to web addresses or files behind the scenes. Sometimes, you need to extract the actual URL from a hyperlink for analysis, sharing, or cleaning up your data.

This article walks you through multiple ways to extract URLs from hyperlinks in Excel, whether you want to use formulas, VBA, or a simple keyboard shortcut. By the end, youโ€™ll have easy, practical methods for grabbing URLs quickly and accurately.

Key Takeaways

Steps to extract URL from Hyperlink using keyboard shortcut in Excel:

โžค Select a cell such as B2 and press  Ctrl  +  K  on your keyboard to open Edit Hyperlink dialog box.
โžค The Address box below displays the URL. Copy it manually using  Ctrl  +  C .
โžค Click Cancel or Close after copying.
โžค Use  Ctrl  +  V  to paste in the URL column.
โžค Repeat the same steps for the rest of the dataset.

overview image


1

Extract URLs Using VBA Function (Works for All Hyperlink Types)

If youโ€™re dealing with hyperlinks that were added manually (not with formulas), Excel doesnโ€™t provide a built-in function to pull out the URL. However, using a short VBA snippet, you can create a custom formula called a User Defined Function (UDF) that extracts the hyperlink address from any cell. This method is perfect for users comfortable with VBA and looking for an automated way to process many links at once.

Steps:

โžค Press  Alt  +  F11  to open the VBA editor.
โžค Click Insert >> Module.
โžค Paste this VBA code:

Function GetURL(cell As Range) As String
ย ย ย  On Error Resume Next
ย ย ย  GetURL = cell.Hyperlinks(1).Address
End Function

Extract URLs Using VBA Function (Works for All Hyperlink Types)

โžค Close the VBA editor by clicking the X or pressing  Alt  +  Q .
โžค Back in your worksheet, if your hyperlink is in cell B2, enter this formula in C2:

=GetURL(B2)

โžค Press Enter and the formula will display the URL from the hyperlink in A2.
โžค Drag the formula down to extract URLs from other cells with hyperlinks.

Your final output is now ready.


2

Display Web Address Inside a HYPERLINK Function

This method is useful only when hyperlinks were created using Excelโ€™s built-in HYPERLINK function. These are common when links are auto-generated or manually added using formulas. Youโ€™ll use a combination of FORMULATEXT, MID, and FIND to extract the actual link from the formula string

Steps:

โžค Assume the hyperlink formula is in cell B2 like

=HYPERLINK(“https://www.google.com”, “Google”).

Display Web Address Inside a HYPERLINK Function

โžค Use this formula to extract the URL:

=TRIM(MID(FORMULATEXT(B2), FIND(“”””, FORMULATEXT(B2)) + 1, FIND(“,”, FORMULATEXT(B2)) – FIND(“”””, FORMULATEXT(B2)) – 2))

โžค Drag down the formula using the AutoFill handle.
โžค This extracts the URL part inside the HYPERLINK formula.

Note:
This method doesnโ€™t work for hyperlinks inserted manually via Insert >> Hyperlink or those linking to files.


3

Manually Copy URLs via Edit Hyperlink Dialog

When you only need to extract a few links and donโ€™t want to deal with VBA or formulas, this manual method is quick and easy. Excel allows you to view and copy hyperlink addresses through the Edit Hyperlink dialog box. You can access this dialog in several ways using right-click, ribbon menu, or keyboard shortcut.

Steps:

โžค Select a cell such as B2 and press  Ctrl  +  K  on your keyboard to open Edit Hyperlink dialog box.

Manually Copy URLs via Edit Hyperlink Dialog
โžค Alternatively, you can right-click the cell containing the hyperlink and select Edit Hyperlink.


โžค You can also access Edit Hyperlink from Insert tab >> Links on the ribbon.


โžค The Address box below displays the URL. Copy it manually using  Ctrl  +  C .
โžค Cancel or Close after copying.


โžค Use  Ctrl  +  V  to paste in the URL column.
โžค Repeat the same steps for the rest of the rows.

Now you have your URLs extracted from your hyperlink.


Downloadable Resources

Get our practice workbook or necessary files that we have worked with to prepare this article.

Extract URL from Hyperlink.xlsx


Frequently Asked Questions

Can I extract URLs from all sheets at once?

Yes. Use VBA to loop through all worksheets and pull hyperlink URLs into a single summary sheet automatically, saving time and manual effort.

Do formulas work for hyperlinks to files or emails?

No. Formulas only work with web links made using the HYPERLINK function. For file paths or mailto links, use VBA to extract them properly.

Is there a built-in Excel function to extract URLs?

No. Excel doesnโ€™t offer a built-in function for this. Youโ€™ll need to use VBA or Power Query for accurate and flexible URL extraction.


Wrapping Up

In this tutorial, we learned several effective ways to extract URLs from hyperlinks in Excel using VBA function for extracting URLs from embedded links, formulas for hyperlinks created with the HYPERLINK function, and manually retrieving URLs using the Edit Hyperlink dialog box. Each approach has its own advantages depending on your data size and technical comfort level. Feel free to download the practice file and share your feedback.

Facebook
X
LinkedIn
WhatsApp
Picture of Tasmia Rahim

Tasmia Rahim

Tasmia Rahim holds a B.Sc in Electrical Engineering with a focus on automation and embedded systems, supporting logic-driven spreadsheet workflows. With 2 years of Excel and Google Sheets experience, she works with conditional formatting and basic automation. She is interested in using macros and ActiveX controls to simplify Excel tasks and improve usability.
We will be happy to hear your thoughts

      Leave a reply


      Excel Insider
      Logo