I have this data set in Excel (google sheet) Sheet1
And these targets by month by city in Sheet2
I would like that cellS AI3 to AK5 highlight if the objective of Sheet2, for the specific city and month are not reached.
I thought that writing this in the conditional format box would work but it doesn't =AI3<INDEX(Sheet2!D:D;MATCH($A3&MONTH(AI$2);Sheet2!$A:$A&Sheet2!$C:$C;0)))
Any idea ?
Thank you
CodePudding user response:
When searching by two or more variables, you can use FILTER. In this case both variables appear to be in the same direction, despite your title. Try with:
=AI3<FILTER(Sheet2!D:D;INDIRECT("Sheet2!$A:$A");$A3;INDIRECT("Sheet2!$C:$C");MONTH(AI$2)))
CodePudding user response:
Your first index argument should have $ as it will "move" to E
and F
for AJ
and AK
otherwise, so Sheet2!D:D
-> Sheet2!$D:$D
. But actually it doesn't matter in this exact case (would matter in Excel) because if you want to refer to other sheets in conditional formatting in google sheets, you need to use INDIRECT
.
Formula:
=AI3<INDEX(INDIRECT("Sheet2!$D:$D");MATCH($A3&MONTH(AI$2);INDIRECT("Sheet2!$A:$A")&INDIRECT("Sheet2!$C:$C");0))
Applied to AI3:AK5
Result: