I have a column of cells in a Google Spreadsheet with values such as:
512
2123
2342
3532
What I would like to do is convert all these into a hyperlink and keep the value as the link text:
http://www.example.com/id/{value}
…where {value} is the value of the cell. I know the format of a hyperlink in a Google spreadsheet but I don't want to do this manually every time I put in a number. I want a simple process that when I add a new row the contents of this column is turned into a link with the value I input.
I tried this:
=HYPERLINK(CONCATENATE("http://www.example.com/id/",A1);A1)
But I get:
error: Circular dependency detected
Best Answer
I wasn't able to reproduce your results. As a matter of fact, it worked perfectly.
What you tried to do is most probably the following:
In
A1
you typed in=HYPERLINK(CONCATENATE("http://www.example.com/id/",A1);A1)
and this yields an error of coarse.Update
If you really want to get the result in
A1
, then you need to use a script.Code
Explained:
The
e.value
will retrieve the cells value (only applicable a cell). ThesetValue()
will add the concatenated string into thegetActiveRange()
. All is only executed whene.value
contains something and the active range is in column A.I've created an extra menu option as well, to be able access the script this way.
Example:
I've created an example file for you: onEdit URL builder
Add this script via Tools>Script editor, into the script editor. Press the "bug" button and you can use the script.