Conditional Formatting Help

ItalianPlatinum

Well-known Member
Joined
Mar 23, 2017
Messages
797
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello I have what I thought was an easy modification, but having issues finding an easy way to solution. I have 3 columns one column is pre, one is post, and the 3rd is differences. I have existing conditional formatting in column C to highlight red if the data isn't zero and green if the data is zero. The new condition i was looking to add is if any data below the header equals zero to highlight the header green and if any don't equal zero to highlight the header red.

PrePostDifferences
12-1
110
220
34-1

So in this scenario "Differences" would be shaded red as well as the first and last record. If those records were zero then all 5 in column C would be shaded green including the header "Differences." Any help is much appreciated as always.
 
And it looks like it is showing cell C1 as green, which is what it should be doing.
This is what you wanted, right?
So what exactly is still the issue?
C1 is green if i don't have any breaks (C2:C5). C1 in this scenario should be red seeing at least 1 item isn't zero.
 
Upvote 0

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
I hope this explains it better:
mr excel questions 17.xlsm
ABCDEFG
1PrePostDifferencesCF Formula to paste into CFInto CF dialog for these cells
212-1FALSE=COUNTIF(C2:C5,0)=0C1Makes C1 GREEN when all are zero
3110TRUE=COUNTIF(C2:C5,0)>0C1Makes C1 RED when at least one is not zero
4220TRUE=(C2<>0)C2, then copy formatMakes C2 GREEN when C2 zero
534-1FALSE=(C2=0)C2, then copy formatMakes C2 RED when C2 is not zero
ItalianPlatinum
Cell Formulas
RangeFormula
D2D2=COUNTIF(C2:C5,0)=0
E2:E5E2=FORMULATEXT(D2)
D3D3=COUNTIF(C2:C5,0)>0
D4D4=(C2<>0)
D5D5=(C2=0)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C1Expression=COUNTIF(C2:C5,0)=0textNO
C2:C5Expression=(C2=0)textNO
C2:C5Expression=(C2<>0)textNO
C1Expression=COUNTIF(C2:C5,0)>0textNO
is it just me or is the first picture saying one thing and the 3 picture is saying something else?

1679571763313.png
 
Upvote 0
is it just me or is the first picture saying one thing and the 3 picture is saying something else?

View attachment 88227
They are the same to me. ignore the colors in the top image. All I did was paste the rule in column E. They have nothing to do with color of the adjacent cells.


Just focus on the instructions:
mr excel questions 17.xlsm
EFG
1CF Formula to paste into CFInto CF dialog for these cells
2=COUNTIF(C2:C5,0)=0C1Makes C1 GREEN when all are zero
3=COUNTIF(C2:C5,0)>0C1Makes C1 RED when at least one is not zero
4=(C2<>0)C2, then copy formatMakes C2 GREEN when C2 zero
5=(C2=0)C2, then copy formatMakes C2 RED when C2 is not zero
ItalianPlatinum
Cell Formulas
RangeFormula
E2:E5E2=FORMULATEXT(D2)
 
Upvote 0
The header should flag green if ALL records are zero (below C1) or flag red if ANY record is not zero (below C1). Hope this clarifies the confusion. to note my dataset is huge 1,000 records. Trying to show the user go find the variance if something isn't zero as zero is ideal. And if they are all zero show green so the user can just stop their review
 
Upvote 0
The header should flag green if ALL records are zero (below C1) or flag red if ANY record is not zero (below C1). Hope this clarifies the confusion. to note my dataset is huge 1,000 records. Trying to show the user go find the variance if something isn't zero as zero is ideal. And if they are all zero show green so the user can just stop their review
and that is what the conditional formatting formula in ROW 2 of POST #23 does, provided you have selected GREEN as the FILL Color.
 
Upvote 0
It must be me and I didn't have my coffee or something but I have exactly what you have? Do you see something different that i don't see. first picture is what I have 2nd picture is what you have right? you have red greater than 0 and green equal to zero. when i pump that through my test its flagging green.
1679572778205.png


1679572812843.png
 
Upvote 0
and that is what the conditional formatting formula in ROW 2 of POST #23 does, provided you have selected GREEN as the FILL Color.
I don't think that is correct. I think you have it backwards.

The formula:
Excel Formula:
=COUNTIF(C2:C5,0)=0
does NOT check that ALL the entries are zero, if checks that NONE of the entries are zero.
 
Upvote 0
One way to check to see if all the entries are zero is like this:
Excel Formula:
=COUNT(C2:C5)-COUNTIF(C2:C5,"0")=0
 
Upvote 0
One way to check to see if all the entries are zero is like this:
Excel Formula:
=COUNT(C2:C5)-COUNTIF(C2:C5,"0")=0
That worked for all zeroes! BINGO. Now the red isn't quite working

1679573685090.png


example if all my records aren't zero it should be red as well. the red only seems to work if at least 1 zero exists
1679573762759.png
 
Upvote 0
If you want it to be red if at least one is not zero, you could use:
Excel Formula:
=COUNT(C2:C5)-COUNTIF(C2:C5,"0")>0
or more simply:
Excel Formula:
=COUNTIF(C2:C5,"<>0")>0
 
Upvote 0

Forum statistics

Threads
1,216,054
Messages
6,128,516
Members
449,456
Latest member
SammMcCandless

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