简体   繁体   English

如果与 Excel 中的公式匹配,则突出显示特定单元格

[英]Highlight the particular cell if matches the formula in Excel

I have entered following formula in Excel.我在 Excel 中输入了以下公式。 How to highlight particular cell/cells that fulfills the condition?如何突出显示满足条件的特定单元格/单元格? Here the highlight column is D, E, and F. While X column relates to the condition requirement.这里突出显示的列是 D、E 和 F。而 X 列与条件要求有关。

=IF(
    OR(
        AND(D5>X12,E5>X29),
        AND(D5>X12,F5>X45),
        AND(E5>X29,F5>X45),
        AND(D5<X16,E5<X33),
        AND(D5<X16,F5<X49),
        AND(E5<X33,F5<X49)),
    "YES",
    "NO")

The "YES" or "NO would be in a particular column eg in I column. But I want to highlight which cell is matching the condition eg D5>X12, E5>X29 both if match the condition then both D5 and E5 should be highlighted as Red color. If only one matches the condition then it should not highlight anyone. “是”或“否”将在特定列中,例如在 I 列中。但我想突出显示哪个单元格与条件匹配,例如 D5>X12、E5>X29 两者都符合条件,则 D5 和 E5 都应突出显示为红色。如果只有一个符合条件,则不应突出显示任何人。

Your grand formula can be rewritten:你的大公式可以重写:

=IF(
     OR(SUM(D5>X12,E5>X29,F5>X45)>1,SUM(D5<X16,E5<X33,F5<X49)>1),
     "YES",
     "NO")

You will have to put 3 different formulas on 3 different cells or columns.您必须在 3 个不同的单元格或列上放置 3 个不同的公式。

Home -> Conditional Formatting -> Manage Rules... ->主页 -> 条件格式 -> 管理规则... ->


New Rule... -> Choose "Use a formula to determine which cells to format"新规则... -> 选择“使用公式确定要格式化的单元格”
Paste the formula: =OR(AND(SUM($D5<$X16,$E5<$X33,$F5<$X49)>1,$D5<$X16),AND(SUM($D5>$X12,$E5>$X29,$F5>$X45)>1,$D5>$X12))粘贴公式: =OR(AND(SUM($D5<$X16,$E5<$X33,$F5<$X49)>1,$D5<$X16),AND(SUM($D5>$X12,$E5>$X29,$F5>$X45)>1,$D5>$X12))

Click "Format..." and choose the format.单击“格式...”并选择格式。
OK -> Applies to =$D$5确定 -> 适用于=$D$5
Apply申请


New Rule... -> Choose "Use a formula to determine which cells to format"新规则... -> 选择“使用公式确定要格式化的单元格”
Paste the formula: =OR(AND(SUM($D5<$X16,$E5<$X33,$F5<$X49)>1,$E5<$X33),AND(SUM($D5>$X12,$E5>$X29,$F5>$X45)>1,$E5>$X29))粘贴公式: =OR(AND(SUM($D5<$X16,$E5<$X33,$F5<$X49)>1,$E5<$X33),AND(SUM($D5>$X12,$E5>$X29,$F5>$X45)>1,$E5>$X29))

Click "Format..." and choose the format.单击“格式...”并选择格式。
OK -> Applies to =$E$5确定 -> 适用于=$E$5
Apply申请


New Rule... -> Choose "Use a formula to determine which cells to format"新规则... -> 选择“使用公式确定要格式化的单元格”
Paste the formula: =OR(AND(SUM($D5<$X16,$E5<$X33,$F5<$X49)>1,$F5<$X49),AND(SUM($D5>$X12,$E5>$X29,$F5>$X45)>1,$F5>$X45))粘贴公式: =OR(AND(SUM($D5<$X16,$E5<$X33,$F5<$X49)>1,$F5<$X49),AND(SUM($D5>$X12,$E5>$X29,$F5>$X45)>1,$F5>$X45))

Click "Format..." and choose the format.单击“格式...”并选择格式。
OK -> Applies to =$F$5确定 -> 适用于=$F$5
Apply申请


OK好的

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

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