count colored cells

Sharksfan

New Member
Joined
Nov 3, 2017
Messages
22
we have a spreadsheet with six columns. The cells in the six columns have conditional formatting and change color based on the value in them. Colors are red, green, and yellow. I want to count the number green and yellow cells in a row. Can this be done? Below is an example, except the cells would be colored (not words) based on conditional formatting. I have tried creating a colorcount function, but because of conditional formatting it only sees them as normal white cells.


[TABLE="width: 500"]
<tbody>[TR]
[TD]Months Sold[/TD]
[TD]L6TTL[/TD]
[TD]L6 SDC[/TD]
[TD]LOC %[/TD]
[TD]L6SDC CUST[/TD]
[TD]AVG cost

[/TD]
[TD]count of Green and Yellow[/TD]
[/TR]
[TR]
[TD]Red[/TD]
[TD]Red[/TD]
[TD]Green[/TD]
[TD]Green[/TD]
[TD]Yellow[/TD]
[TD]Green[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Green[/TD]
[TD]Green[/TD]
[TD]Green[/TD]
[TD]Green[/TD]
[TD]Red[/TD]
[TD]Yellow[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
You can use function COUNTIFS by mirroring all the conditions that trigger the CndFrmt. In other words, if AVG Cost is CndFrmt green because it meets a certain condition and LOC% is yellow because it meets some other condition, etc, use COUNTIFS with your six fields in your data as each of the arguments in COUNTIFS.
 
Upvote 0
If the values that trigger the background color are simply one number for yellow (e.g., 6) and one number for green (e.g., 4), then G2 (fill down) could be:

Code:
=COUNTIF(A2:F2,4)+COUNTIF(A2:F2,6)

For example, if Green's number could be either a 4 or 5, then this should count:

Code:
=COUNTIF(A2:F2,4)+COUNTIF(A2:F2,5)+COUNTIF(A2:F2,6)
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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