Conditional Formatting based on value of another sheet - google-sheets

I am using below formula that is working fine on same sheet to highlight the row where found "Terminated".
=$E3="Terminate"
I want to highlight the same row on other sheets as well where found "Terminate" on "Leave Data" sheet range E3.
Each sheet has same Employees name on Col B. May that would made it easy to highlight the same row on other sheets
Can someone please share a solution to this question.

Conditional formatting does not support direct sheet references, but you can "trick" it by using INDIRECT and CELL:
So in cell A1 of Sheet3, create a conditional formatting rule valid for the whole range A1:A100 and insert this formula:
=INDIRECT("Sheet2!"&CELL("address", E1))="Terminate"
INDIRECT
CELL
Explanation
Between INDIRECT and CELL, it creates an "indirect" reference to the value of the target cell which conditional formatting can understand.
You can also make it fill the whole row by adding a $ to the E as in this formula:
=INDIRECT("Sheet2!"&CELL("address", $E1))="Terminate"

Related

Google Sheets Conditional Formatting custom formula not working to same as in cells

So have an ArrarFormula in H5 that works exactly the way I want. It searched all the cells in column C and compares them to column A and returns TRUE when column C contains column A. The problem is that I want to move that formula to conditional formating. When I do that it only captures some of the cells, highlighted in Blue. Here is the formula.
=ARRAYFORMULA(IFNA( LEN(REGEXEXTRACT(C5:C, JOIN("|",QUERY(A5:A, "Select A where not A is null")))) > 0))
I have tried copy/pasting to conditional formatting and removing the ArrayFormula and the IFNA. I still get the same results. I know that I can just reference column H in conditional formatting, but I want to try to keep this as clean as possible.
Here is a link to the sheet. https://docs.google.com/spreadsheets/d/1xT_U_UZ27X724VAGwUjZ_6fHkE6IaegnbzQTC_kOfEg/edit?usp=sharing
I just modified your original formula so it can work with conditional formatting:
=IFNA( LEN(REGEXEXTRACT(C5, JOIN("|",QUERY($A$5:$A, "Select A where not A is null")))) > 0)
Remove array formula and just use C5, the conditional formatting will automatically adjust its row based on your selected Apply to range
You need to fix the range in your query() by locking its row and column using $
Output:

How to make a custom conditional formatting formula point to the contents of a cell reference

I have a spreadsheet with a custom formula that changes the colour of different cells based on the value in the dates column. I also frequently have to change the formula based on different times of the month.
I would like the formula to point to a cell eg A1 so that whenever I change the contents of A1, the custom formula itself will change.
Currently the custom conditional formatting formula is =E2>=TODAY() -21
I alternate between this and =AND(E2>DATE(2019,3,23),E2<DATE(2019,4,20))
I've tried to use =INDIRECT(A1) as the formula, with A1 cell content =E2>=TODAY() -21 but this doesn't work. I would really appreciate any tips on how to get this working.
custom formula:
=IF((($A$1="=E2>=TODAY()-21")*(E2>=TODAY()-21))+
(($A$1="=AND(E2>DATE(2019,3,23),E2<DATE(2019,4,20))")*((E2>DATE(2019,3,23))*(E2<DATE(2019,4,20)))),1)
demo spreadsheet

Highlight row based on duplicate cell contents google sheets

The answer in this question Highlighting Duplicate Rows in Google Sheets works perfectly to highlight the duplicate cells in a column. What I'm wanting to do is one step futher and highlight the rows that each of those duplicated cells are in.
So if I've got duplicated cells in column c that are highlighted, how do I also highlight the rows?
Thanks!
Here's the current formatting I have to highlight duplicates in Column C.
Current conditional formatting equation
Change Apply to range to A1:Z (change Z to last column you want to highlight). And change the Custom formula to =countif($C:C,$C1)>1. You need to use the absolute reference ($).

Google Sheets Conditional Formatting For a Column

I have a spreadsheet that has dates in row 1 and data in the rows below it. I want to highlight the entire column that has a date that is today, or within the last 7 days.
I've been searching and I keep finding examples of how to highlight a row, but not a column.
Please try selecting all cells and: Format - Conditional formatting..., Custom formula is and:
=and(A$1>today()-7,A$1<today()+1)
with highlighting of your choice. Done.
In this case the row is anchored, I agree more usual to anchor ($) the column.

Conditional Formatting from another sheet

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(),)))

Resources