Color coding coloumn

Helloitsme

New Member
Joined
Feb 19, 2021
Messages
28
Office Version
  1. 365
Platform
  1. Windows
So I'm trying to make <5/10 red, 5-6.9/10 yellow, and 7-10/10 green. For the life of me I can't figure out how...

Pricebook19JAN22.xlsx
S
1ATS
2 
35,8/10
45,5/10
54,8/10
66,3/10
75,3/10
86,1/10
9 
102,6/10
1110/10
127,2/10
Listings
Cell Formulas
RangeFormula
S2:S12S2=IF(COUNT(O2,Q2),ROUND(AVERAGE(O2,Q2),1)&"/10","")


Thanks in advance for any and all help!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Use the Formula option of Conditional Formatting, and create three rules, one for each color, i.e.

Red:
Excel Formula:
=AND(COUNT(O2,Q2),ROUND(AVERAGE(O2,Q2),1)<5)

Yellow:
Excel Formula:
=AND(COUNT(O2,Q2),ROUND(AVERAGE(O2,Q2),1)>=5,ROUND(AVERAGE(O2,Q2),1)<7)

Green:
Excel Formula:
=AND(COUNT(O2,Q2),ROUND(AVERAGE(O2,Q2),1)>=7,ROUND(AVERAGE(O2,Q2),1)<=10)
 
Upvote 0
Solution
If only it was that easy... the outcome of this is:

Pricebook19JAN22.xlsx
S
1ATS
2 
35,8/10
45,5/10
54,8/10
66,3/10
75,3/10
86,1/10
9 
102,6/10
1110/10
127,2/10
Listings
Cell Formulas
RangeFormula
S2:S12S2=IF(COUNT(O2,Q2),ROUND(AVERAGE(O2,Q2),1)&"/10","")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
S:SExpression=AND(COUNT(O2;Q2);ROUND(AVERAGE(O2;Q2);1)>=7;ROUND(AVERAGE(O2;Q2);1)<=10)textNO
S:SExpression=AND(COUNT(O2;Q2);ROUND(AVERAGE(O2;Q2);1)>=5;ROUND(AVERAGE(O2;Q2);1)<7)textNO
S:SExpression=AND(COUNT(O2;Q2);ROUND(AVERAGE(O2;Q2);1)<5)textNO


Any other ideas? I should mention the blanks should also be left colorless :)
 
Upvote 0
Just change the first rule to this to avod the blanks:
Excel Formula:
=AND(COUNT(O2,Q2),ROUND(AVERAGE(O2,Q2),1)>0,ROUND(AVERAGE(O2,Q2),1)<5)

I tried it, and it works perfectly like this:
1642703201902.png


You made one of the most common mistakes people make when using formulas in Conditional Formatting.
If you are selecting a mult-cell range to apply it to, you MUST write the formula as it pertains to the VERY FIRST cell in your selection.
It looks like that you selected the whole column S (and not just where the data starts). So you will need to change the row reference in all the formulas to reference row 1 instead of row 2, since the first cell in your selection in S1.

If you ever see Conditional Formatting that looks like it is "shifted up/down" by a row or two, that is usually the reason.

Note that in your original example you posted, you were applying it to the range S2:S12, which is why I wrote all the formulas referencing row 2.
However, in your last posting, your change to the entire column S (S:S).
 
Upvote 0
I see your point thanks! The color coding still doesn't seem to work correctly though:

Pricebook19JAN22.xlsx
S
1ATS
2 
35,8/10
45,5/10
54,8/10
66,3/10
75,3/10
86,1/10
9 
102,6/10
1110/10
127,2/10
Listings
Cell Formulas
RangeFormula
S2:S12S2=IF(COUNT(O2,Q2),ROUND(AVERAGE(O2,Q2),1)&"/10","")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
S2:S150Expression=AND(COUNT(O2;Q2);ROUND(AVERAGE(O2;Q2);1)>0;ROUND(AVERAGE(O2;Q2);1)<5)textNO
S2:S150Expression=AND(COUNT(O3;Q3);ROUND(AVERAGE(O3;Q3);1)>=5;ROUND(AVERAGE(O3;Q3);1)<7)textNO
S2:S150Expression=AND(COUNT(O3;Q3);ROUND(AVERAGE(O3;Q3);1)>=7;ROUND(AVERAGE(O3;Q3);1)<=10)textNO


Do you reckon it's because I'm using commas instead of dots for data? This is the standard in Denmark.
 
Upvote 0
Look closely at your yellow and green formulas.
You are applying them to range S2:S150, but you are referencing row 3, not row 2 in your formulas!
Always compare your formula to the range you are applying them to, like I described in my previous post!
 
Upvote 0
Oh so I can't have my first conditional format cell be empty, got it, i think :)

There's still some issues though:

Pricebook19JAN22.xlsx
S
1ATS
2 
35,8/10
45,5/10
54,8/10
66,3/10
75,3/10
86,1/10
9 
102,6/10
1110/10
127,2/10
Listings
Cell Formulas
RangeFormula
S2:S12S2=IF(COUNT(O2,Q2),ROUND(AVERAGE(O2,Q2),1)&"/10","")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
S3:S150Expression=AND(COUNT(O3;Q3);ROUND(AVERAGE(O3;Q3);1)>0;ROUND(AVERAGE(O3;Q3);1)<5)textNO
S3:S150Expression=AND(COUNT(O4;Q4);ROUND(AVERAGE(O4;Q4);1)>=5;ROUND(AVERAGE(O4;Q4);1)<7)textNO
S3:S150Expression=AND(COUNT(O4;Q4);ROUND(AVERAGE(O4;Q4);1)>=7;ROUND(AVERAGE(O4;Q4);1)<=10)textNO
 
Upvote 0
Oh so I can't have my first conditional format cell be empty, got it, i think
No, that is NOT what I am saying at all. I am saying that whatever range your select to apply the Conditional Formatting too, you need to write your formula as it applies to the very first cell in your selection. Those row number references should match.

Look at what you posted:
1642708119206.png

Note how on your first CF rule (the red one), it is applied to the range S3:S150, and all your row references in that formula are for row 3?
You did that one perfectly.

But then note that last two (yellow and green). The rules are applied to the range S3:S150, but all your row references are for row 4!
That means that the formatting for cell S3 will look at row 4, the formatting for S4 will look at row 5, the formatting for S5 will look at row 6, etc
You selected cells and formula row references are off by 1 row! You need to fix this so the bottom two rules reference row 3, not row 4.

If you do not know how to fix the existing rule, then just delete those two and start again.
 
Upvote 0
THANK YOU for your patience and explanation, I finally got it right! Sorry to be such a bother haha...

If anyone needs this fix, here's the info:

Pricebook19JAN22.xlsx
S
1ATS
2 
35,8/10
45,5/10
54,8/10
66,3/10
75,3/10
86,1/10
9 
102,6/10
1110/10
127,2/10
Listings
Cell Formulas
RangeFormula
S2:S12S2=IF(COUNT(O2,Q2),ROUND(AVERAGE(O2,Q2),1)&"/10","")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
S2:S150Expression=AND(COUNT(O2;Q2);ROUND(AVERAGE(O2;Q2);1)>0;ROUND(AVERAGE(O2;Q2);1)<6)textNO
S2:S150Expression=AND(COUNT(O2;Q2);ROUND(AVERAGE(O2;Q2);1)>=6;ROUND(AVERAGE(O2;Q2);1)<7,5)textNO
S2:S150Expression=AND(COUNT(O2;Q2);ROUND(AVERAGE(O2;Q2);1)>=7,5;ROUND(AVERAGE(O2;Q2);1)<=10)textNO


Thanks so much Joe, you're a lifesaver!
 
Upvote 0
You are welcome.

Note that I went back and marked the initial post with the formulas as the solution.
All the posts after that were just working out the details to implement it correctly, but that initial post contained the needed formulas.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

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