简体   繁体   English

带索引(匹配)的条件格式,2 个条件(垂直和水平)

[英]Conditional formatting with Index(Match), 2 conditions (vertical & horizontal)

I have this data set in Excel (google sheet) Sheet1我在 Excel (google sheet) Sheet1 中有这个数据集

![在此处输入图片描述

And these targets by month by city in Sheet2这些目标按月按城市显示在 Sheet2 中

![在此处输入图片描述

I would like that cellS AI3 to AK5 highlight if the objective of Sheet2, for the specific city and month are not reached.如果未达到特定城市和月份的 Sheet2 目标,我希望 cellS AI3 到 AK5 突出显示。

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)))我认为在条件格式框中写这个会起作用,但它不会=AI3<INDEX(Sheet2:D;D;MATCH($A3&MONTH(AI$2):Sheet2:$A;$A&Sheet2!$C:$C;0)))

Any idea?任何的想法?

Thank you谢谢

When searching by two or more variables, you can use FILTER.按两个或多个变量搜索时,可以使用 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)))

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 .你的第一个索引参数应该有 $ 因为它将“移动”到AJAKEF否则,所以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 .但实际上在这种情况下并不重要(在 Excel 中很重要)因为如果你想在谷歌工作表中引用条件格式的其他工作表,你需要使用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适用于AI3:AK5

Result:结果:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM