简体   繁体   English

EXCEL - 条件格式(2 个公式,一个单元格)

[英]EXCEL - CONDITIONAL FORMATTING (2 formula, one cell)

I am struggling to have two formulas into one cell to have different conditional formatting.我正在努力将两个公式放入一个单元格以具有不同的条件格式。 When I tested both formula separately, it worked.当我分别测试两个公式时,它起作用了。 But combining it to one formula但将其组合成一个公式

=IF(I30<(TODAY()+60),"FOLLOW UP", IF(M30="COMPLETED", "DONE", ""))  

it doesn't work as it keeps showing "Follow up" and ignored the status "Completed"它不起作用,因为它一直显示“跟进”并忽略状态“已完成”

Basically what I am trying to have is "Highlight cell in PINK "TO FOLLOW UP" if it is today+60 days.. Highlight cell in GREEN "DONE" if status shows COMPLETED.基本上我想要的是“突出显示粉红色的单元格“跟进”,如果是今天+60 天。如果状态显示完成,突出显示绿色“完成”的单元格。

appreciate if someone could help.如果有人可以提供帮助,不胜感激。 Thanks a lot.非常感谢。

在此处输入图片说明

Setting the cell's value and its CF are two different operations.设置单元格的值和它的 CF 是两个不同的操作。 Let's set the value first.让我们先设置值。

Most probably, the fact that a subject is "completed" is overriding any other considerations.最有可能的是,主题已“完成”这一事实凌驾于任何其他考虑因素之上。 Therefore, IF(C5="COMPLETED","DONE" must come first. The second condition fits into the else part of that IF statement. IF((I4+60)<TODAY(),"TO FOLLOW UP","") . There seems to be a logical error in your data calculation. Please adjust my suggestion to fit your actual needs. This would be the combined formula.因此, IF(C5="COMPLETED","DONE"必须先出现。第二个条件适合该 IF 语句的else部分IF((I4+60)<TODAY(),"TO FOLLOW UP","") . 你的数据计算似乎有逻辑错误,请根据你的实际需要调整我的建议,这就是组合公式。

IF(C5="COMPLETED","DONE",IF((I4+60)<TODAY(),"TO FOLLOW UP",""))

Note that the date is only compared if the item isn't "completed".请注意,仅当项目未“完成”时才比较日期。 You might fill in the "" of the second IF with a text that is applied if the date comparison is False.如果日期比较为 False,您可以使用文本填充第二个 IF 的""

Now you can look at the CF.现在您可以查看 CF。 It's important to remember that the cell has a color, perhaps "no color" (=white) which is shown if no conditional color is set.重要的是要记住,单元格有一种颜色,如果没有设置条件颜色,可能会显示“无颜色”(=白色)。 Then, you need a separate condition for every color you want to set, and you should specify the sequence in which the conditions are to be applied.然后,您需要为要设置的每种颜色设置一个单独的条件,并指定应用条件的顺序。 Conditions will be applied in the sequence in which you enter them but you can also change the sequence later in the CF Manager.条件将按照您输入的顺序应用,但您也可以稍后在 CF 管理器中更改顺序。

Let's say, you want to follow the same logic as above: if the item is completed the cell should be green.假设您想遵循与上述相同的逻辑:如果项目完成,单元格应该是绿色的。 You can use a very similar formula, =C5="COMPLETED" .您可以使用非常相似的公式=C5="COMPLETED" Or you might test for the value of the cell itself, like =B5="DONE" .或者您可以测试单元格本身的值,例如=B5="DONE" Of course, the cell value would be "DONE" if C5="COMPLETED".当然,如果 C5="COMPLETED",单元格值将是 "DONE"。 In either case you set the cell fill to green.在任何一种情况下,您都将单元格填充设置为绿色。

Now you can set a second format, like =(I4+60)<TODAY() and set the fill color to buff or pink or whatever.现在您可以设置第二种格式,例如=(I4+60)<TODAY()并将填充颜色设置为浅黄色或粉红色或其他颜色。 CF will first check the first condition and then the second and this isn't what you want. CF 将首先检查第一个条件,然后检查第二个条件,这不是您想要的。 So, you go to the Manage Rules dialog box of the CF menu and place a checkmark in the Stop if True column (last on the right).因此,您转到 CF 菜单的“ Manage Rules对话框并选中“如果为真停止”列(右侧最后一个)中的复选标记。 This will cause Excel not to examine or apply the second condition if the first one evaluates to True .如果第一个条件的计算结果为True这将导致 Excel 不检查或应用第二个条件。

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

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