Conditional formatting formula with 2 criterias.

strongman86

Board Regular
Joined
Feb 15, 2017
Messages
115
Office Version
  1. 2019
Platform
  1. Windows
Hi all,

Looking for formula to use in conditional formatting to colour cells if 2 criterias are met. Conditional formatting will be applied to column D. Numbers on column D will be compared with numbers in column B. For example: If D1 = B1 & if C1 = "PM" then highlight D1 cell, if C = AM then don't colour. Also if any cell in D is 0 then colour only if adjcent C cell is "AM". End result should be D1-highlighted,D2-NOT highlighted, D3-NOT highlighted,D4-highlighted,D5-highlighted,D6-NOT highlighted.
Thanks.

BCD
15PM5
26AM0
31AM0
42PM2
53PM3
62PM0
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
not sure i follow

Also if any cell in D is 0 then colour only if adjcent C cell is "AM".
as D2 =0 and C2 = AM - so highlight
as D3 =0 and C3 = AM - so highlight

=OR(AND($C1="PM",$D1=$B1),AND($C1="AM",$D1=0))

Book1
ABCD
115PM5
226AM0
331AM0
442PM2
553PM3
662PM0
Sheet3
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D1:D6Expression=OR(AND($C1="PM",$D1=$B1),AND($C1="AM",$D1=0))textNO


for 2007, 2010 , 2013 , 2016 , 2019 or 365 Subscription excel version
Conditional Formatting

Highlight applicable range >>
D1:D100 - Change, reduce or extend the rows to meet your data range of rows

Home Tab >> Styles >> Conditional Formatting
New Rule >> Use a formula to determine which cells to format
Edit the Rule Description: Format values where this formula is true:
=OR(AND($C1="PM",$D1=$B1),AND($C1="AM",$D1=0))

Format [Number, Font, Border, Fill]
choose the format you would like to apply when the condition is true
OK >> OK
 
Upvote 0
not sure i follow


as D2 =0 and C2 = AM - so highlight
as D3 =0 and C3 = AM - so highlight

=OR(AND($C1="PM",$D1=$B1),AND($C1="AM",$D1=0))

Book1
ABCD
115PM5
226AM0
331AM0
442PM2
553PM3
662PM0
Sheet3
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D1:D6Expression=OR(AND($C1="PM",$D1=$B1),AND($C1="AM",$D1=0))textNO


for 2007, 2010 , 2013 , 2016 , 2019 or 365 Subscription excel version
Conditional Formatting

Highlight applicable range >>
D1:D100 - Change, reduce or extend the rows to meet your data range of rows

Home Tab >> Styles >> Conditional Formatting
New Rule >> Use a formula to determine which cells to format
Edit the Rule Description: Format values where this formula is true:
=OR(AND($C1="PM",$D1=$B1),AND($C1="AM",$D1=0))

Format [Number, Font, Border, Fill]
choose the format you would like to apply when the condition is true
OK >> OK
Sorry copy paste curse :D I meant highlight for D2& D3. =OR(AND($C1="PM",$D1=$B1),AND($C1="AM",$D1=0)) works perfectly. Thank you very much.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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