Reputation: 23
How to generate a link based on parameters inputed by a user for a specific cell?
ex:
cell A1: user input is "123456" cell A1 link: www.abc.com/?id=123456
Upvotes: 0
Views: 46
Reputation: 1
try:
=HYPERLINK("www.abc.com/?id="&A1, A1)
for arrayformula use:
=INDEX(IF(A1:A, HYPERLINK("www.abc.com/?id="&A1:A, A1:A), ))
Upvotes: 0
Reputation: 11184
This is the closest thing I can think of. If it is just solely generated by a formula, you can't input a text in a cell and expect it to have a different formula. So you need to have the links generated on another cells and the input on another cells
=ArrayFormula(if(A2:A<>"",hyperlink("www.abc.com/?id="&A2:A),))
But via script, that would be possible:
function onEdit(e) {
// if input is in "Sheet1!A2:A" range, convert to link automatically
if(e.range.getRow() > 1 && e.range.getColumn() == 1 && e.source.getActiveSheet().getSheetName() == 'Sheet1' && e.value != null) {
e.range.setValue('=hyperlink("www.abc.com/?id='+ e.value +'")');
}
}
Upvotes: 2