Forum Discussion

warrevar's avatar
warrevar
Brass Contributor
Mar 25, 2024

Hyperlinks as Conditional Formatting?

I would like to turn a cell into a hyperlink when text is entered into that same cell.  The text entered into the cell would be the very last part of the hyperlink, which is concatenated with the rest of the url.

 

Example: I enter 'kittens' into cell B3 and hit enter.  Cell B3 then turns into the following hyperlink: https://www.google.com/search?q=kittens

 

Can this be achieved with conditional formatting (i.e., if cell is not blank, become a hyperlink)? Really trying to avoid creating a separate cell for concatenating text to create my hyperlinks...

  • warrevar 

    No, you cannot do that with conditional formatting. It would require VBA, but assembling the URL and using the HYPERLINK function in a separate column is much easier.

  • kortnie's avatar
    kortnie
    Copper Contributor

    I have found that you can accomplish this by setting the value_if_false portion to hyperlink to a cell on your sheet.

    For example :

    =IF(H38<>"",HYPERLINK("google.com/search?q="&H38,H38),HYPERLINK(H38,""))

     


    If H38 = "kittens", then your cell would show the word "kittens" and would be a hyperlink (to a google search for kittens, in this example).
    If H38 is blank, then your cell would be blank and would not actually perform any action when clicked.

     

Share

Resources