I'm trying to make something like this: https://productivityspot.com/search-in-google-sheets/
But in my case, "search cell" and cells that need to be highlighted are in the different sheets.
And I need to be able to search for multiple strings, not just one.
So, here is the exact problem:
The table is located in a sheet called "Tabela"
City names are in cells C4, C5, C6, etc.
I need to type city names in another sheet called "Filter" in cells AP5, AP6, AP7, etc., and in cells AQ5, AQ6, AQ7, etc.
When in sheet "Filter" I write "Tuzla" in cell AP5 and "Lukavac" in cell AP6, I need every "Tuzla" and every "Lukavac" in the sheet "Tabela" in C4 and below to be highlighted with red.
And when I do that in cells AQ5, AQ6, etc., I need them highlighted in green.
So, cities entered in AP column should be highlighted red, and cities entered in AQ should be highlighted green. And if the same city is entered in both the AP and AQ column, some kind of warning would be nice.
Solution:
You can use INDIRECT function in your conditional formatting custom formulas to highlight cells based on values from different sheet:
In your sample, you would need three rules:
Highlight Cells Red:
Custom Formula: =COUNTIF(INDIRECT("Filter!$AP5:$AP"), $C4)>0
Highlight Cells Green:
Custom Formula: =COUNTIF(INDIRECT("Filter!$AQ5:$AQ"), $C4)>0
For the warning, you can turn the cells a different color (I'll use gray). This rule should be on the top.
Custom Formula: =COUNTIF(INDIRECT("Filter!$AP5:$AQ"), $C4)>0
Sample Sheet:
References:
INDIRECT()
Conditional Formatting from another sheet
Related
Populating a dynamic event calendar from a separate sheet and want the titles of each event to be bold font.
Conditional formatting works if I am comparing to a single string or cell with text, but there are multiple titles that would appear in each column.
Need to use "Text is exactly" or a custom formula, where if any of the cells in column D for example match any of the titles from column E of another sheet, make them bold.
A separate sheet can only be accessed via the "INDIRECT" function, but even when I pull the list of titles onto the same sheet, it does not work.
Have tried the built in "Text is exactly", also tried custom formulas using TEXT, EXACT, IF, etc. but can't seem to get it to work.
Tried custom formula:
=$E$8:$E$52=TEXT($E$55,$E$56) This only matches the first instance (E8 to E55)
Format range E8:E52 with this conditional formatting custom formula rule:
=match(E8, E$55:E$56, 0)
To get the titles from the other sheet, use something like this:
=match(E8, indirect("Sheet2!A2:A"), 0)
I have a Google sheet where I need to dynamically update cell background color in multiple cells within a table based on the compared value of another cell in a table within the same sheet(Cell value in the reference table gets updated through a form which updates value regularly(Yes,No or NA values in ref table)
The table being referenced is in the range B989:W1008. And matched data in the other table; to be color coded based on string match in the reference table (Green if Yes, Red if No, empty or NA is white); is present at C2:X21.
The match is made on this condition: If B989 cell value is Yes, color code for background of cell C2 is green, No yields red, NA or Empty yields white background.
I have the conditional formula for this as =B989="Yes" for green and =B989="No" for red but need to extend this to refer each cell individually to the next cell across the reference range. ie C2 gets referred to B989, C3 to B990, D2 to C989 and so on. I'd like to avoid manually editing in the formula for individual cells
What can I use for this?
Can you use INDIRECT to handle a cell offset, similar to what's described in Google Sheets conditional formatting based on relative reference using another sheet's cell values?
Something like this:
=INDIRECT("R"&ROW()+987&"C"&COLUMN()+1,FALSE)
This is using the optional is_a1_notation parameter described in https://support.google.com/docs/answer/3093377?hl=en&ref_topic=3105472
I'm trying to get a cell to highlight with a certain color if the text of two other cells match. Has anyone else done this?
Example:
If the value in the cell A2 is "Car" and the value "Car" is in a range on another sheet, can the cell B2 be filled with a color?
Assuming a range on another sheet is ColumnC of Sheet2, then select B2, apply the Conditional Formatting custom formula:
=match(A2,indirect("Sheet2!C:C"),0)
and certain colour fill.
This can be achieved using conditional formatting.
Select the cell (B2 in your example) and in the menu bar go to Format > Conditional Formatting...
Here you want to use a custom formula. Specifically for your example, the formula to input would be:
=AND(A2="Car",COUNTIF(C2:C5,"Car")>0)
Note that the range that is being checked for "Car" is C2:C5, since you didn't specify any for your example.
EDIT:
Following the discussion in the comments:
=COUNTIF(Sheet2!$C:$C,A2)>0
What this does, is that it looks for the value in A2 in column C in Sheet2 and if it occurs once or more, the cell that you have applied this conditional formatting to, will be coloured.
I have tried using the conditional formatting custom formula on this, but no such luck. Basically, in the "Location" sheet if the text in a cell in column A matches the text in a cell in Sheet "Jobs" column A, then change the background to blue.
In the Location tab/sheet, I tried a custom formula to compare the value to the value of column A in the Jobs sheet but keep getting an invalid formula error.
=A2:A="JOBS!A2:A"
Do I need to use a custom script instead?
Use INDIRECT. This will work with two sheets where Sheet1 A2:A is equal to JOBS!A2:A and JOBS!A2:A is not blank.
Apply to Range
A2:A
Custom Formula
=AND(A2:A=indirect("JOBS!A2:A"), A2:A<>"")
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?
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.
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)
Comparing strings instead of numbers for a conditional formatting rule, you can use:
=EXACT(A1,(INDIRECT("Sheet2!A1")))
Case sensitive.
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).
I was able to compare two sheet and highlight the differences on the second sheet using conditional formatting :
=A1<>(INDIRECT("Sheet1!"&Address(Row(),Column(),)))