Search code examples
regexgoogle-sheetsgoogle-sheets-formulags-conditional-formatting

Google sheet conditional formatting if the cell contains ref to another sheet


Is it possible to create conditional formatting that will color a cell if it contains a reference to a different sheet of the same document? More generically, is it possible to create a conditional formatting based not on the value of a cell bu on the formula behind a cell?

I hope my question is clear!


Solution

  • not very clear but if you are after this then it's possible:

    0

    custom formula would be:

    =ISFORMULA(B1)
    

    this would highlight all formulae of course so you will need to further narrow it down for example by using FORMULATEXT with regex like:

    =ISFORMULA(B1)*REGEXMATCH(FORMULATEXT(B1), "^\=[A-Z]\d|^\={[A-Z]\d")
    

    0

    which would not highlight any other formulae like for example =SUM(1+2)