Howdy,
I would like to have a script that inserts a hyperlink into column C based on what the value in column B is.
The URL I would like to direct to will depend on what is in a cell in that row. If "batman" is in there, I need a link to the "batman" area of the website. If "superman", I need a link to "superman" in the website. See the following example: [ignore the
fact that the URL isn't real, it's just to simplify it for explanation]
Here's the formula I am using for now:
=HYPERLINK("https://www.google.com/batman/Status!openForm&Id="&B225,"Link")
So, if in cell B225 I have "batman-1248", the link would take me to https://www.google.com/batman/Status!openForm&Id=1234
This works so far, however, see in the URL where I have "batman"? This is only correct if "batman" is mentioned in the cell B225. I have many entries that are either Batman, Superman, Spiderman and will need the URL to change depending on which is in cell
B225 (or the corresponding cell in column B for the same row).
In other words, if B225 is "spiderman-193" and I use the previously mentioned formula, it will send me to https://www.google.com/batman/Status!openForm&Id=spiderman-193. ...but my spiderman stuff isn't in the /batman/ area of the site, it should
be /spiderman/Status!openForm...
If I have a cell with "superman-1294", I would like the URL to change the /batman/ to be /superman/ and etc for spiderman, "/batman/" needs to be "/spiderman/"
I figure this shouldn't be too hard, I have thought about doing an "IF" statement, but figure that could get kind of long...something like "IF B225 contains "batman", then URL with /batman/, else IF B225 contains "spiderman", then URL with /spiderman/ ... but
that could get confusing and isn't (I don't think) the "correct" way to do this.
Thanks for any help, and I would be glad to clarify if the above is confusing or convoluted.