Conditional Formatting from another sheet

Google SheetsGs Conditional-Formatting

Google Sheets Problem Overview


I'm trying to have a cell on Sheet A check if it's either > or < the value in a cell on Sheet B, then change its color accordingly. Under the custom formula I use: =A1>("SheetB!A1"), but it doesn't seem to work. I use the color Green for the > and the color Red for the <. Every time the rules are saved it will always display A1 on Sheet A in red.

Is the function wrong? Or is it not possible to have a Conditional Format even search across sheets?

Google Sheets Solutions


Solution 1 - Google Sheets

For some reason (I confess I don't really know why) a custom formula in conditional formatting does not directly support cross-sheet references.

But cross-sheet references are supported INDIRECT-ly:

=A1>INDIRECT("SheetB!A1")

or if you want to compare A1:B10 on SheetA with A1:B10 on SheetB, then use:

=A1>INDIRECT("SheetB!A1:B10")

=A1>INDIRECT("SheetB!"&CELL("address",A1))

applied to range A1:B10.

Solution 2 - Google Sheets

You can do this by referencing the cell and row number in the current sheet, so as you drag-copy that conditional formatting to other rows it will reference the correct cells. In the below equation I am coloring cells based on the exact same cell in some other sheet named "otherSheetName" in this example. If for example you want to color cell B2 in Sheet2 if the cell B2 in otherSheetName contains the text "I Like Dogs" you would go to cell Sheet2!B2 , click condition formatting, choose equation from the drop down and paste the below equation.

=IF(INDIRECT("otherSheetName!"&ADDRESS(ROW();COLUMN()))="I Like Dogs";1;0)

Solution 3 - Google Sheets

Comparing strings instead of numbers for a conditional formatting rule, you can use:

=EXACT(A1,(INDIRECT("Sheet2!A1")))

Case sensitive.

Solution 4 - Google Sheets

There is one trick/bug: if you have conditional formatting in Sheet1 that explicitly references itself (e.g., the formula is Sheet1!$C$2), you can copy the conditional formatting to Sheet2 with Paste special > conditional formatting and it will "work"... as long as you don't touch anything:

  • if you try to edit the conditional formatting in Sheet2, then you'll get an "Invalid formula" error.
  • if columns/rows change in Sheet1 such that they affect the conditional formatting (e.g., row/column inserts), this is not reflected in Sheet2 (keep in mind that the indirect trick mentioned by @AdamL will also not reflect column/row updates either, so it's a wash in this respect).

Solution 5 - Google Sheets

I was able to compare two sheet and highlight the differences on the second sheet using conditional formatting :

=A1<>(INDIRECT("Sheet1!"&Address(Row(),Column(),)))

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJoshView Question on Stackoverflow
Solution 1 - Google SheetsAdamLView Answer on Stackoverflow
Solution 2 - Google Sheetsuser34612View Answer on Stackoverflow
Solution 3 - Google SheetsskkeptickleView Answer on Stackoverflow
Solution 4 - Google SheetskuporificView Answer on Stackoverflow
Solution 5 - Google SheetswlarchevequeView Answer on Stackoverflow