Multiple conditional formatting to the same range

David Montoya

New Member
Joined
Apr 25, 2018
Messages
49
Dear,

Please help me with the following situation.

I need to have the following two conditional formatting to the same range W4 to W1004:

Code:
=IF(IF(AND($Q4=""),($W4=""),IF(AND($Q4="N/A"),($W4=""),IF(AND($Q4<>""),($W4<>"")))),"",IF(AND($Q4<>""),($W4="")))

Code:
=IF(IF(AND($M4=""),($W4=""),IF(AND($M4="N"),($W4=""),IF(AND($M4<>""),($W4<>"")))),"",IF(AND($M4<>""),($W4="")))

They both work fine independently; however, when join them together, as follows:

Code:
=IF(IF(AND($M4=""),($W4=""),IF(AND($M4="N"),($W4=""),IF(AND($M4<>""),($W4<>""),(IF(AND($Q4=""),($W4=""),IF(AND($Q4="N/A"),($W4=""),IF(AND($Q4<>""),($W4<>"")))))))),"",IF(AND($M4<>""),($W4=""),IF(AND($Q4<>""),($W4=""))))

only the first conditional formatting works, and the second do not work.

Thanks in advance for your help.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi David,
what exactly are you trying to achieve?
Looking at your formulas the ANDs aren't actually doing anything.
e.g. =IF(AND($M4=""),($W4="") If you are trying to check if M4 and W4 are blank the formula should be =IF(AND($M4="",$W4="")
 
Upvote 0
Formulas in conditional format should not use the IF statement, only the condition:

=AND($M4="",$W4="")


If the condition is true then the cell is highlighted
 
Upvote 0
Dante Amor,

The purpose is to highlight in red the same row cell in column W if the result is “TRUE” when combining the data on column M with column W of the same row, and/or column Q with W.

Here is the information:
1. Cell in column M could be blank, contain “Y”, or “N”
a. If the cell in column M is blank, and cell in column W is blank, is ok
b. If the cell in column M contains “N”, and cell in column W is blank, is ok
c. Cell in column M contains “Y”, and cell in column W contains data, is ok
d. If the cell in column M contains “Y”, then cell in column W must have a data input


This portion works OK with this formula, giving the “TRUE” result:
Code:
=IF(IF(AND($M4=""),($W4=""),IF(AND($M4="N"),($W4=""),IF(AND($M4<>""),($W4<>"")))),"",IF(AND($M4<>""),($W4="")))

2. Cell in column Q could be blank, contain “N/A”, or other multiple choices
a. If the cell in column Q is blank, and cell in column W is blank, is ok
b. If the cell in column Q contains “N/A”, and cell in column W is blank, is ok
c. Cell in column Q contains “ANY AVAILABLE CHOICE”, and cell in column W contains data, is ok
d. If the cell in column Q contains “ANY AVAILABLE CHOICE”, then cell in column W must have a data input


This portion works OK with this formula, giving the “TRUE” result:
Code:
=IF(IF(AND($Q4=""),($W4=""),IF(AND($Q4="N/A"),($W4=""),IF(AND($Q4<>""),($W4<>"")))),"",IF(AND($Q4<>""),($W4="")))

The above two conditional formatting work fine when set independent .

I have been trying to put the two above formulas together to have a single conditional formatting rule, and it only works for one of the portions, either the above “1.” or if I invert the sequence, it works for the above portion “2.”

Here is the formula I put together:

Code:
=IF(IF(AND($M4=""),($W4=""),IF(AND($M4="N"),($W4=""),IF(AND($M4<>""),($W4<>""),IF(AND($Q4=""),($W4=""),IF(AND($Q4="N/A"),($W4=""),IF(AND($Q4<>""),($W4<>""))))))),"",IF(AND($M4<>""),($W4=""),IF(AND($Q4<>""),($W4=""))))

This formula is to be included into a macro; I have seen other VBA macro options that may accomplish the same, but I have not been able to get even close.


Thanks a lot.
 
Upvote 0
Try this

Formula 1:

Code:
=OR([COLOR=#a52a2a]AND($M4="",$Q4="")[/COLOR],[COLOR=#008000]AND($M4="N",$Q4="")[/COLOR],[COLOR=#0000ff]AND($M4="Y",$Q4<>"")[/COLOR])
Formula 2:

Code:
=OR([COLOR=#b22222]AND($Q4="",$W4="")[/COLOR],[COLOR=#008000]AND($Q4="N/A",$W4="")[/COLOR],[COLOR=#0000ff]AND($Q4<>"",$W4<>"")[/COLOR])


Formula 1 and 2:
Code:
=OR([COLOR=#008000]OR(AND($M4="",$Q4=""),AND($M4="N",$Q4=""),AND($M4="Y",$Q4<>""))[/COLOR],[COLOR=#0000ff]OR(AND($Q4="",$W4=""),AND($Q4="N/A",$W4=""),AND($Q4<>"",$W4<>""))[/COLOR])
 
Upvote 0

Forum statistics

Threads
1,214,601
Messages
6,120,467
Members
448,965
Latest member
grijken

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