Multiple Conditional Formatting in Excel

privxls

Board Regular
Joined
Nov 22, 2016
Messages
55
Office Version
  1. 2021
Platform
  1. Windows
Hi Mr Excel,

I would like to ask a new favor from all of you who may have encountered this:
VIcGfGY.jpg


It goes like this:
-> =IF(D4>=D3) background is yellow
-> =IF(D4<D3) background is red
-> =IF(AND(D5>=D3,AND(D5>=D4) background is yellow
-> =IF(AND(D5>=D3,AND(D5<D4) background is blue
And so on... however, not all the conditons are being followed, how many conditions do I need to set? Or is this even possible?

Kind regards,
Priv

 
Last edited by a moderator:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Clarification please.
For D6 to be yellow, does it need to be >= all 3 above or just the 2 immediately above?
For D6 to be blue/purple/red, does it need to be compared with (D3 and D5) or (D4 and D5) or something else?
 
Last edited:
Upvote 0
You will need a rule for each color and condition. Set up the sequence so that the top-level criteria are met 1st, and make sure to check the "stop if true" box
 
Upvote 0
Hi Peter,
Each cell just needs to be compared to the one above it -- with the exception of D3 as it is the target/goal and D4 being the first item that needs to be filled out before the comparison would begin for the remaining cells.

Kind regards,
Priv
 
Upvote 0
Hi FDibbins,

I'm experimenting on this one now, I will post the results in a bit. Thank you!
 
Upvote 0
Do these look right? In particular, what about cell D8 that doesn't seem to meet any of your written conditions.

For cell D4 I manually formatted as yellow and then applied just one CF rule as shown below.
Then selected D5:Dxx and applied the other rules.

Excel Workbook
D
385.00%
489.00%
586.33%
684.12%
784.13%
884.13%
987.00%
10
11
CF privxls
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D41. / Formula is =D4Abc
D51. / Formula is =AND(D5<>"")Abc
D52. / Formula is =AND(D5D4)Abc
D53. / Formula is =AND(D5>=D$3,D5Abc
D54. / Formula is =AND(D5>=D$3,D5>D4)Abc
 
Last edited:
Upvote 0
Peter,

The formulas are truncated. It seems HTML Maker is not working well.

M.
Thanks Marcelo - I should have known to check for that, especially since I had already edited the OP's post to fix the exact same problem! :oops:
It isn't the HTML maker (yes, jeanie) but the usual problem with the forum when a < sign is immediately followed by a letter.
I have edited the post to fix.
Thanks again for picking it up. :)
 
Upvote 0
Thanks so much everyone, this has resolved my concern, props to Peter_SSs and also to FDibbins for the help regarding the conditions / formulas and thanks to Marcelo too for pointing out the typo/error with the format :)
Much appreciated guys :)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top