I have a column with hyperlinks formula in it, for example:
=HYPERLINK("http://example.com", "Link")
I want to get additional column, where only urls (as a text) from the first column will be present, that is, in this example:
http://example.com
Is there a function that allows extraction of an url from HYPERLINK? I was thinking also about getting formula text from the first column and cutting it with SPLIT/SUBSTITUTE in the final one, but I'm not sure if I can get one field code into another field.
Highlight the URL from the Address input in the Edit Hyperlink menu and press Ctrl + C to copy. Press Esc on your keyboard or press the Cancel button to close the Edit Hyperlink menu. Select a new cell and press Ctrl + V to paste the URL into Excel.
If you just want to format existing text into a hyperlink: Select the text that you want to turn into a hyperlink, and right-click it. On the shortcut menu, click Hyperlink. In the Insert Hyperlink dialog, paste the link in the Address box and click OK.
Just type =””& and then the cell (no parenthesis) that you want to retrieve the link text from. Then hit Enter.
To create a hyperlink from a lookup, you can use the VLOOKUP function together with the HYPERLINK function. The hyperlink function allows you to create a working link with a formula. It takes two arguments: link_location and, optionally, friendly_name.
Try this formulas
A2=index(SPLIT(SUBSTITUTE(FORMULATEXT(A1),"=HYPERLINK(""",""),""","""),1,1)
example
A1=HYPERLINK("http://example.com", "Link")
result is
A2=http://example.com
I just created this script and it worked
function URL(reference) {
var sheet = SpreadsheetApp.getActiveSheet();
var formula = SpreadsheetApp.getActiveRange().getFormula();
var args = formula.match(/=\w+\((.*)\)/i);
try {
var range = sheet.getRange(args[1]).getRichTextValue().getLinkUrl();
}
catch(e) {
throw new Error(args[1] + ' is not a valid range');
}
return range;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With