简体   繁体   中英

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.

appreciate if someone could help. Thanks a lot.

在此处输入图片说明

Setting the cell's value and its CF are two different operations. 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((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.

Now you can look at the 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.

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" . Or you might test for the value of the cell itself, like =B5="DONE" . Of course, the cell value would be "DONE" if C5="COMPLETED". 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. CF will first check the first condition and then the second and this isn't what you want. 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). This will cause Excel not to examine or apply the second condition if the first one evaluates to True .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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