Conditional formatting question

Lade

New Member
Joined
Jun 7, 2023
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hello,

Hopefully this will all make sense.

I have a spreadsheet that I enter measurements into. I have all the parts in rows 17 - 117 and the measurements in columns W - AN. If the measurement is below 0.7 then I want that cell to turn red, which is no problem. But where I'm running into issues is the next step.
I want the header of each column to turn red when there is a measurement that fails in that column. For example, if the measurement in cell W20 is 0.4, then I want the header for column W to turn red. For some reason I can't get anything to work right.

Currently this is what I have in the conditional formatting as the formula for the header (cells W16 - AN16):

Excel Formula:
=AND(OR((W$17:W$117)>0),(OR((W$17:W$117)<0.7)))

The reason I'm not just using a simple <0.7 is because excel then flags all the blank cells in that range also that haven't been filled in yet. So I'm trying to do ">0 and <0.7", that way it doesn't flag blanks. This is the latest formula I've ended up with so far through research and fiddling around with it. The problem with it is that it does absolutely nothing LOL, nothing changes in the header when I type a value into the table greater than 0 but less than 0.7.

Anything thoughts?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Perhaps consider using:
Excel Formula:
=OR((W$17:W$117>0)*(W$17:W$117<0.7))
 
Upvote 0
Solution
Should be able to use a simple COUNTIFS formula:
Excel Formula:
=COUNTIFS(W$17:W$117,">0",W$17:W$117,"<0.7")>0
 
Upvote 0
The two conditions each produce an array of zeroes and ones, which are then multiplied with each other. A row which meets both conditions will be one where a one is multiplied with another one. One is recognized as TRUE by excel, and the OR function ensures that if any ones appear in the array, the conditional formatting rule is triggered.

You can see what the array looks like by pasting the formula into a regular cell.
 
Upvote 0
The two conditions each produce an array of zeroes and ones, which are then multiplied with each other. A row which meets both conditions will be one where a one is multiplied with another one. One is recognized as TRUE by excel, and the OR function ensures that if any ones appear in the array, the conditional formatting rule is triggered.

You can see what the array looks like by pasting the formula into a regular cell.
Interesting, but I think it may be a little unnecessarily complicated, when there is already a built-in function that does that, at least in this case.
 
Upvote 0
Should be able to use a simple COUNTIFS formula:
Excel Formula:
=COUNTIFS(W$17:W$117,">0",W$17:W$117,"<0.7")>0
Just for curiosity I tried this one also and it worked too! I guess there's more than one way to skin a cat. Thanks for both of your help, I really appreciate it!
 
Upvote 0
Just for curiosity I tried this one also and it worked too! I guess there's more than one way to skin a cat. Thanks for both of your help, I really appreciate it!
Yes, that was my point - is that there is already a function that was designed to do exactly what you are asking, so there is no need to re-invent the wheel.
See here for more details on the COUNTIFS function: MS Excel: How to use the COUNTIFS Function (WS)
 
Upvote 0

Forum statistics

Threads
1,223,707
Messages
6,174,000
Members
452,542
Latest member
Bricklin

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