Conditional Formatting Multiple Criteria

wmtsub

Active Member
Joined
Jun 20, 2018
Messages
322
I would like to use the conditional formatting feature with a custom formula but can't get it to work.
What I am trying to do is to highlight a cell [d2] if it is less than 10 BUT only if cell [d5] is ALSO under 50.

Would any one be able to assist me?
Thanks

-Eds
 
is D5 a straight numerical value, or is it a percentage?
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
It is a new sheet I created but to be safe I cleared the entire sheet of conditional formatting.
And your rule produces no results.
 
Upvote 0
Make sure you have number in the cells instead of number stored as text.
 
Upvote 0
In that case I cannot think why it doesn't work.
 
Upvote 0
It is a very simple, straightforward rule which should work.
There must be something you are not doing correctly, or some other factor coming in to play.
Are you in cell D2 when you enter the Conditional Formatting rule?

Try going to a blank sheet (or new workbook), and run this VBA code. This will add your Conditional Rule, and values to cell D2 and D10.
You should see cell D2 then turn yellow.
Code:
Sub MyCFMacro()

    Range("D2").FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=AND(D2<10,D5<50)"
    With Range("D2").FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
    End With
    
    Range("D2") = "5"
    Range("D5") = "25"

End Sub
If this works, inspect the rule and the values, and see how it differs from what you have been trying.
 
Upvote 0
Thanks that does the same thing....
What exactly does it do?
It should highlight cell D2 yellow. Does it not?
 
Upvote 0

Forum statistics

Threads
1,216,460
Messages
6,130,765
Members
449,589
Latest member
Hana2911

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