Skip to main content

How to extract actual addresses from hyperlinks in Excel?

Supposing you have a range of cells which contain hyperlinks, and now you need to see the real destination of the hyperlinks and extract them from the hyperlinks as following screenshot shown. Are there any easy ways to solve this problem quickly? This article will guide you to extract actual addresses from multiple hyperlinks.


arrow blue right bubble Extract actual addresses from hyperlinks with Edit Hyperlink feature

Here, the Edit Hyperlink function can help you extract the underlying URL for each of these hyperlinks and place that actual address into a different cell. You can do as this:

1. Select the cell with hyperlink and right-click, from the context menu, choose Edit Hyperlink, see screenshot:

2. And an Edit Hyperlink dialog box will be appeared, select and copy (Ctrl+C) the entire URL from the Address field of the dialog box.

3. Then close the dialog box and paste the actual address into any cell you want.

Note:With this method, you can extract only one hyperlink address each time, but if you have multiple hyperlinks need to be extracted, you need to apply this function repeatedly.


arrow blue right bubble Extract actual addresses from hyperlinks with VBA code

For a lot of hyperlinks, the above method will be tedious and time consuming, so the following VBA code can help you quickly extract multiple addresses from the hyperlinks at once.

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

Sub Extracthyperlinks()
'Updateby Extendoffice
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
    If Rng.Hyperlinks.Count > 0 Then
        Rng.Value = Rng.Hyperlinks.Item(1).Address
    End If
Next
End Sub

3. Then press F5 key to run the code, and a dialog pops out for you to select the hyperlinks that you want to extract the real addresses, see screenshot:

4. Then click OK, and the selected cell contents have been converted to the real hyperlink addresses in the original range. See screenshots:


arrow blue right bubble Extract actual addresses from hyperlinks with User Definde Function

The following User Defined Function also can extract the actual URl from the hyperlinks.

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

Function GetURL(pWorkRng As Range) As String
'Updateby Extendoffice
    GetURL = pWorkRng.Hyperlinks(1).Address
End Function

3. Save the code and close the window, select a blank cell to type this formula =GetURL(A2) (A2 is the cell that the hyperlink in), and press Enter button. You can see the real hyperlink address is extracted.


arrow blue right bubble Extract actual addresses from hyperlinks with Kutools for Excel quickly and easily

Here is a handy tool, called Kutools for Excel, with its Convert Hyperlinks feature, you can quickly deal with the following operations:

  • Extract actual addresses from hyperlinks;
  • Convert url text to clickable hyperlinks.
Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.

If you have installed Kutools for Excel, please do as follows:

1. Select the range which contains the hyperlinks need extracting.

2. Click Kutools > Link > Convert Hyperlinks, see screenshot:

3. In the Convert Hyperlinks dialog box, select Hyperlinks addresses replace cell contents option, and click doc-button1 button from Result range to specify a cell to put the result.

4. And then click OK, the actual addresses have been extracted from the hyperlinks. See screenshot:

Note: If you want to put the actual addresses to the original range, please check Convert source range.

Click Convert Hyperlinks to know more about this feature.

Download and free trial Kutools for Excel Now !


arrow blue right bubble Demo: Extract actual addresses from hyperlinks with Kutools for Excel

Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Download and free trial Now!

Related article:

How to convert url text to clickable hyperlink in Excel?

Best Office Productivity Tools

Supercharge Your Spreadsheets: Experience Efficiency Like Never Before with Kutools for Excel

Popular Features: Find/Highlight/Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns     Move Columns   |   Unhide Columns   |   Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolset12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   Many More...

Kutools for Excel boasts over 300 features, ensuring that what you need is just a click away...

Supports Office/Excel 2007-2021 & newer, including 365   |   Available in 44 languages   |   Enjoy a full-featured 30-day free trial.

kte tab 201905


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (44)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bonjour
Auriez vous une solution pour mettre en place le fonctionnement par la formule sur Excel 365 sur Mac ?
This comment was minimized by the moderator on the site
Hello, Edouard,
Sorry, the methods in this article are only applied to Microsoft Excel.
Thank you!
This comment was minimized by the moderator on the site
Ola colegas ,

Tenho uma planilha com mais de 2000 linhas, preciso exportar o documento que esta no hiperlink estas celulas, para um diretório da maquina, alguém sabe como fazer ?

agradeço a atenção

at..
cássia
This comment was minimized by the moderator on the site
Thank you it solve my problem
This comment was minimized by the moderator on the site
Thank you, the VBA code worked like a charm :)
This comment was minimized by the moderator on the site
Thank you for the tip to Extract Actual Addresses From Hyperlinks in Excel With VBA Code. It was exactly what I needed!
This comment was minimized by the moderator on the site
How does this apply to Excel on Mac?
This comment was minimized by the moderator on the site
I think it's nice to have an option that doesn't require macros since so many haven't used VBA at all.
This comment was minimized by the moderator on the site
If you're not comfortable with VBA, the key step to getting this done is the FORMULATEXT() formula that is included with excel. For example, if cell A1 has this...
=HYPERLINK("https://www.google.com","Google Homepage")
...then it would display "Google Homepage" but you want to extract "https://www.google.com". You can use =FORMULATEXT(A1) to get the output of "=HYPERLINK("https://google.com","Google Homepage")".

Then you use the find and mid functions to find the double quotes (which is CHAR(34)) and pull the string between the first two double quotes. Nesting it all together, you can use this formula to get the URL without any VBA required...
=MID(FORMULATEXT(A1),FIND(CHAR(34),FORMULATEXT(A1))+1,FIND(CHAR(34),FORMULATEXT(A1),FIND(CHAR(34),FORMULATEXT(A1))+1)-FIND(CHAR(34),FORMULATEXT(A1))-1)
This comment was minimized by the moderator on the site
Thankyou for an easy method to extract the complete URL from a weblink. I looked at other methods that were too nebulous but yours was straightforward and easy. Thanks.
This comment was minimized by the moderator on the site
Thanks for the " Extract actual addresses from hyperlinks with VBA code" VBA and clear instructions. It worked great for me.
This comment was minimized by the moderator on the site
Trying to save time creating multiple Hyperlinks and hoped this program would help with the task. I have combined several columns containing text into a single cell and then used the Edit/Link to create a working URL. Is there a tool to modify the URL to display text characters of the URL.
This comment was minimized by the moderator on the site
Hi, How to do the same in google sheets
This comment was minimized by the moderator on the site
hello, sujan,
To extract all real addresses from hyperlinks in Google sheets, the following script code can help you:

function linkURL(reference) {
var sheet = SpreadsheetApp.getActiveSheet();
var formula = SpreadsheetApp.getActiveRange().getFormula();
var args = formula.match(/=\w+\((.*)\)/i);
try {
var range = sheet.getRange(args[1]);
}
catch(e) {
throw new Error(args[1] + ' is not a valid range');
}
var formulas = range.getFormulas();
var output = [];
for (var i = 0; i < formulas.length; i++) {
var row = [];
for (var j = 0; j < formulas[0].length; j++) {
var url = formulas[i][j].match(/=hyperlink\("([^"]+)"/i);
row.push(url ? url[1] : '');
}
output.push(row);
}
return output
}

After copying and pasting the above code, go back to your sheet, and apply this formula:=linkURL(A2).
Please try it, hope it can help you, thank you!
This comment was minimized by the moderator on the site
Hi,thank you for reply. I'm getting following error. and LinkUrl is not detecting as function
This comment was minimized by the moderator on the site
Hi, sujan,
The script code is worked correctly in my google sheet, see screenshot:
This comment was minimized by the moderator on the site
Hi Can you share with me a sample link please. The function is not detecting in my file
This comment was minimized by the moderator on the site
Hi,
Can you give your email account, and i will share the file with you!
Thank you!
This comment was minimized by the moderator on the site
This comment was minimized by the moderator on the site
Sujan, I have shared the file with you, please check.
This comment was minimized by the moderator on the site
Thanks!!!!!
This comment was minimized by the moderator on the site
Ah, amazing! Thank you!
This comment was minimized by the moderator on the site
pretty..and nice...and fantabulouslyfntastikittilybumpershumperazardubiliousipaparazziastically yummy :P huh!
This comment was minimized by the moderator on the site
You have no idea how much time you saved me!!! Thank you so much!!!!!!!!!!!!!!!!!!!
This comment was minimized by the moderator on the site
Very nice tool! I converted 16K+ links. Tool worked fast and flawless.
This comment was minimized by the moderator on the site
Thanks so much! Saved me big time of having to do 800+ of these cells!
This comment was minimized by the moderator on the site
For some reason this doesn't work for me. I created the defined function just as you described, but it doesn't do anything :\ I also want to merge it with the Hyperlink function, like so: =HYPERLINK(=getURL(A1), [A1]) So that the final result will copy A1's URL and display it as A1's text string (i.e. just copy A1 to another cell, including both its text and hyperlink. A simple thing which Excel doesn't seem to be able to do for some reason...).
This comment was minimized by the moderator on the site
This saved me a ton of time! I extracted 500 profile IDs from 500+ names linked to their profiles. This code worked extremely well and was easy to follow. Thanks so much!
This comment was minimized by the moderator on the site
Superb! reduced my work to less than a minute.
This comment was minimized by the moderator on the site
thanks for saving me 15mins
This comment was minimized by the moderator on the site
This is the first ever macro based excel tip that worked for me. Thank you very much for making the lives of excel dummies better.
This comment was minimized by the moderator on the site
Thank you so much :lol: I used the VBA method and it worked like a charm in Excel 365 on a Windows 8.1 OS
This comment was minimized by the moderator on the site
thanks a ton. like everyone else here. this is very helpful and easy.
This comment was minimized by the moderator on the site
Super! So easy. Thanks!
This comment was minimized by the moderator on the site
Thanks a lot! Very helpful yet simple and clear. Just as Albert meant :roll:
This comment was minimized by the moderator on the site
Thankyou so much. it really helped me
This comment was minimized by the moderator on the site
Thanks buddy.It really work in seconds.
This comment was minimized by the moderator on the site
You are the best, so easy to follow!
This comment was minimized by the moderator on the site
Thank you so much this saved my ass and make me look good. 8)
This comment was minimized by the moderator on the site
Thank You SO SO much!
This comment was minimized by the moderator on the site
thnx u made my work so easy
This comment was minimized by the moderator on the site
This just saved me! Thanks
This comment was minimized by the moderator on the site
thanks so much!!! :D
This comment was minimized by the moderator on the site
Thankyou so much. it really helped me
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations