简体   繁体   English

Excel两种条件格式

[英]Excel two conditional formatting

Is there a way to have a cell reference to two rules in conditional formatting? 有没有办法在条件格式中对两个规则进行单元格引用?

As a teacher I have a spreadsheet of the grades of 26 children. 作为一名老师,我有一个26个孩子的年级电子表格。

Column A: Target = 100 A栏:目标= 100
Column B: Actual scores of test 1 B栏:考试1的实际分数
Column C: Actual scores of test 2 (taken a month after test 1) C栏:测试2的实际分数(在测试1之后的一个月内获得)
Column D: Difference between column C and column B (to see if their scores went up or down or stay flat after a month) D列:C列和B列之间的差异(以查看他们的分数在一个月后是上升还是下降还是保持不变)
Column E: How far the score of test 2 is from the target E栏:测验2的分数与目标相距多远

Is there a way to use Icon Sets so that if the scores go down from test 1 to test 2 (ie, shows a down arrow), but the score of test 2 is within range of the target, then it will be a green down arrow? 有没有一种使用图标集的方法,以便如果分数从测试1下降到测试2(即显示向下箭头),但是测试2的分数在目标范围内,则将变为绿色箭头?

Vice versa, if the scores go up from test 1 to test 2 (ie, shows an up arrow), but the score of test 2 is only 20 out of 100, for example (out of range of the target), then it will be a red up arrow? 反之亦然,如果分数从测试1上升到测试2(即显示向上箭头),但是测试2的分数仅为100的20(例如,超出目标范围),则它将是红色的向上箭头?

I can do the two separately by using the difference formula, but I can't seem to get both of them to work at the same time. 我可以使用差分公式分别完成这两个操作,但是似乎无法同时使它们同时工作。

If you want icons, I think you'll need to add a column to calculate the summary. 如果您需要图标,我想您需要添加一列来计算摘要。 If both C and D are 'bad' when the value is negative, and they have the same scale, then this formula in column E should do what you need: 如果C和D在值均为负数时均为“差”,并且标度相同,则E列中的此公式应满足您的要求:

=MIN(C2,D2)

You can then apply the conditional formatting to column E. 然后,您可以将条件格式应用于列E。

If all you want is fill or font changes, then you can use an AND() or OR() function to combine conditions in your conditional format. 如果只需要填充或更改字体,则可以使用AND()OR()函数以条件格式组合条件。 You can read more about how to use formulas in conditional formatting here , but assuming your data is in row 2, the following formula should do what you need: 您可以在此处阅读有关如何在条件格式中使用公式的更多信息,但是假设您的数据在第2行中,则以下公式应该可以满足您的需要:

=OR(D2>0,C2<0)

Hope it helps! 希望能帮助到你!

As has been mentioned, with the built-in Icon Sets it is not possible to have a green down arrow or a red up arrow, let alone having both red and green up and down arrows at the same time. 如前所述,内置图标集不可能有绿色的向下箭头或红色的向上箭头,更不用说同时具有红色和绿色的向上和向下箭头了。

However, what you are after is possible by using arrow characters, combined with a conditional formatting formula rule to set the colours. 但是,你以后有什么用箭头人物,具有条件格式公式规则来设置颜色组合可能的。 An extra column is also required if you wish to display the test score differences as well as the arrows. 如果您希望显示测试分数差异以及箭头,则还需要一个额外的列。

The following screenshot shows some sample data, the key formulae used, and the resulting arrows: 以下屏幕截图显示了一些示例数据,使用的关键公式以及结果箭头:

电子表格的屏幕截图

Setup: 设定:

Enter the following formulae into the designated cells: 在指定的单元格中输入以下公式:

E2=C2-B2 E2=C2-B2

F2=C2-A2 F2=C2-A2

D2=CHOOSE(2+SIGN(E2),"È","Æ","Ç") D2=CHOOSE(2+SIGN(E2),"È","Æ","Ç")

and copy-paste/fill-down/ctrl-enter them into the rest of the table. 然后将其复制粘贴/填充/下移/ Ctrl输入到表的其余部分。

Set two conditional formatting formula rules for column D of the table (eg, $D$2:$D$8 ): 为表的列D设置两个条件格式公式公式(例如$D$2:$D$8 ):

=F2 <0 → red font colour =F2 <0 →红色字体颜色
=F2>=0 → green font colour =F2>=0 →绿色字体颜色

Finally, set the font and size of column D of the table ( $D$2:$D$8 ) appropriately for the characters chosen. 最后,设置字体和列的尺寸D表中的( $D$2:$D$8 )适当地为所选择的字符。 (In this example I'm using the 14pt bold Wingdings 3 characters.) (在此示例中,我使用的是14pt粗体Wingdings 3个字符。)

Notes: 笔记:

  • The order of the characters in the D2 formula is "down arrow", "side-ways arrow", and then "up arrow". D2公式中字符的顺序是“向下箭头”,“侧向箭头”,然后是“向上箭头”。

The other table is just to demonstrate some possible arrows and colours that you could use. 另一个表格只是为了演示一些可能使用的箭头和颜色。 I have repeated the table below so you can copy-paste the characters directly: 我已经重复了下表,因此您可以直接复制粘贴字符:

  Wingdings 3   Wingdings    Calabri    
11pt 14pt_bold  14pt_bold   11pt_bold   
ã       Ç       ñ   ñ       ↑   ↑
ã       Ç       ñ   ñ       ↑   ↑
â       Æ       ð   ó       →   ↔
â       Æ       ð   ó       →   ↔
â       Æ       ð   ó       →   ↔
ä       È       ò   ò       ↓   ↓
ä       È       ò   ò       ↓   ↓

If you make a formula like the following: 如果您创建如下所示的公式:

式

Then you have a column E with a positive number if they have increased the result and a negative value if they have decreased the score. 然后,如果列E的结果增加,则为正数;如果列分数降低,则为负数。

Then mark the column and choose: 然后标记该列并选择:

Conditional formating -> New rule 条件格式->新规则

新的自定义格式

And add a custom formating like this. 并添加这样的自定义格式。

带有图标的自定义格式

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

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