How to Count or Sum cells with Colors

Manny74

Board Regular
Joined
May 6, 2016
Messages
124
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi All,

I have rows 1 thru 21, with data in column B.

How would I count or sum the number of green cells?

I have tried to google this and want to keep this simple, so I'm hoping I don't need to use VBA....

Sorry, I had colors on my spreadsheet, but when I copied it onto the body of my post, the colors (light green) disappeared, so I made the font Arial black (ex. B2, B4, etc.), so you can pretend those are the light green cells I need to count/sum.....


[TABLE="width: 128"]
<tbody>[TR]
[TD="width: 64"] 1[/TD]
[TD="class: xl75, width: 64"]B[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="class: xl68"]62.09%[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="class: xl69"]699[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="class: xl68"]75.40%[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="class: xl70"] 57[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD="class: xl63"]0[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD="class: xl70"] 0[/TD]
[/TR]
[TR]
[TD="align: right"] 8[/TD]
[TD="class: xl63"] 58[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD="class: xl64"] 88.73%[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD="class: xl65, width: 64"] 0%[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD="class: xl71, width: 64"]1[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD="class: xl66"]71%[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD="class: xl67, width: 64"] 33[/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD="class: xl64"] 55.49%[/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD="class: xl64"] 90.00%[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD="class: xl72"]0.00[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD="class: xl73"]0.00[/TD]
[/TR]
[TR]
[TD="align: right"]18[/TD]
[TD="class: xl72"]1.64[/TD]
[/TR]
[TR]
[TD="align: right"]19[/TD]
[TD="class: xl74"]511[/TD]
[/TR]
[TR]
[TD="align: right"]20[/TD]
[TD="class: xl72"]5.01[/TD]
[/TR]
[TR]
[TD="align: right"]21[/TD]
[TD="class: xl70"]708[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
If the coloring is done by conditional formatting then you can use the same condition to sum the cells. If they are manual colored the you would need VBA.
 
Upvote 0
How are the cells being coloured?
 
Upvote 0
Well I used conditional formatting for each cell...
The user must meet a certain target for each cell (goal)

So for example, B2 (62.09), if it's equal to or greater than 50% then it would be green....
 
Upvote 0
Yes I used conditional formatting for all the cells.
So how would I used conditional formatting to count the numbers of green cells?
Keep in mind, each cell has a different target amount....
 
Last edited:
Upvote 0
You could use
=COUNTIF(B:B,">50.0%")

Although your description & data don't match
 
Upvote 0
I used conditional formatting.
Every cell represents the users score...I use conditional formatting to see which user met the target goal-score (green) and who did not...
 
Upvote 0
Numbers like 699 and 57 would be greater than 50%, so would also be highlighted.
So, how did those ones NOT get highlighted?
What is your exact Conditional Formatting formula?
Or is the CF rule only being applied on certain rows (and not all of them)?
 
Upvote 0
Yes I used conditional formatting for all the cells.
So how would I used conditional formatting to count the numbers of green cells?
Keep in mind, each cell has a different target amount....

Maybe something like this

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
A
[/TD]
[TD="bgcolor: #DCE6F1"]
B
[/TD]
[TD="bgcolor: #DCE6F1"]
C
[/TD]
[TD="bgcolor: #DCE6F1"]
D
[/TD]
[TD="bgcolor: #DCE6F1"]
E
[/TD]
[TD="bgcolor: #DCE6F1"]
F
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD][/TD]
[TD]
Values​
[/TD]
[TD]
Target​
[/TD]
[TD][/TD]
[TD]
Count​
[/TD]
[TD]
Sum​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD][/TD]
[TD="bgcolor: #D8E4BC"]
62,09%​
[/TD]
[TD]
50%​
[/TD]
[TD][/TD]
[TD]
7​
[/TD]
[TD]
4,4271​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD][/TD]
[TD]
699​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
4
[/TD]
[TD][/TD]
[TD="bgcolor: #D8E4BC"]
75,40%​
[/TD]
[TD]
60%​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
5
[/TD]
[TD][/TD]
[TD]
57​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
6
[/TD]
[TD][/TD]
[TD]
0​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
7
[/TD]
[TD][/TD]
[TD]
0​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
8
[/TD]
[TD][/TD]
[TD]
58​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
9
[/TD]
[TD][/TD]
[TD="bgcolor: #D8E4BC"]
88,73%​
[/TD]
[TD]
50%​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
10
[/TD]
[TD][/TD]
[TD="bgcolor: #D8E4BC"]
0%​
[/TD]
[TD]
0%​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
11
[/TD]
[TD][/TD]
[TD]
1​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
12
[/TD]
[TD][/TD]
[TD="bgcolor: #D8E4BC"]
71%​
[/TD]
[TD]
60%​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
13
[/TD]
[TD][/TD]
[TD]
33​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
14
[/TD]
[TD][/TD]
[TD="bgcolor: #D8E4BC"]
55,49%​
[/TD]
[TD]
50%​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
15
[/TD]
[TD][/TD]
[TD="bgcolor: #D8E4BC"]
90,00%​
[/TD]
[TD]
70%​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
16
[/TD]
[TD][/TD]
[TD]
0​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
17
[/TD]
[TD][/TD]
[TD]
0​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
18
[/TD]
[TD][/TD]
[TD]
1,64​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
19
[/TD]
[TD][/TD]
[TD]
511​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
20
[/TD]
[TD][/TD]
[TD]
5,01​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
21
[/TD]
[TD][/TD]
[TD]
708​
[/TD]
[TD]
1000​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Formula in E2
=SUMPRODUCT(--(B2:B21>=C2:C21))

Formula in F2
=SUMPRODUCT(--(B2:B21>=C2:C21),B2:B21)

M.
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,218
Members
453,024
Latest member
Wingit77

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