ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to extract a web address from a hyperlink cell? (https://www.excelbanter.com/excel-discussion-misc-queries/119042-how-extract-web-address-hyperlink-cell.html)

El Rebelde

How to extract a web address from a hyperlink cell?
 
I hava column of data that shows "friendly" website names. I want to extract
the actual website URLs that are embedded in the data. Anyone know how?

Gary''s Student

How to extract a web address from a hyperlink cell?
 
Use this tiny UDF:

Function hyp(r As Range) As String
Dim s As String

If r.HasFormula Then
s = r.Formula
s_array = Split(s, Chr(34))
hyp = s_array(1)
Else
hyp = r.Hyperlinks(1).Address
End If
End Function


for example =hyp(A1)

This will work if either the hyperlink was inserted directly or via the
=HYPERLINK() function.
--
Gary's Student


"El Rebelde" wrote:

I hava column of data that shows "friendly" website names. I want to extract
the actual website URLs that are embedded in the data. Anyone know how?


El Rebelde

How to extract a web address from a hyperlink cell?
 
Thanks GS; that worked perfectly.

"Gary''s Student" wrote:

Use this tiny UDF:

Function hyp(r As Range) As String
Dim s As String

If r.HasFormula Then
s = r.Formula
s_array = Split(s, Chr(34))
hyp = s_array(1)
Else
hyp = r.Hyperlinks(1).Address
End If
End Function


for example =hyp(A1)

This will work if either the hyperlink was inserted directly or via the
=HYPERLINK() function.
--
Gary's Student


"El Rebelde" wrote:

I hava column of data that shows "friendly" website names. I want to extract
the actual website URLs that are embedded in the data. Anyone know how?



All times are GMT +1. The time now is 03:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com