Count Number of Highlighted Cells

elephant97

Board Regular
Joined
Sep 18, 2002
Messages
63
I have a spreadsheet that I go through and highlight different cells based on data requirements. Specifically, I highlight the cells either green, yellow, or red. How can I use the COUNT function (or something else) to count the number of greens, yellows, and reds and return the totals for each color in a different spreadsheet??? Thanks!
 
NateO, Great routine...works perfectly. I just have one dilemma...can you do something like this that only counts highlighted cells that are visible? I have a table with multiple columns and rows, and I need to filter based on city (for example). When I use your function it counts all cells in the range (table) even though only maybe two rows are visible (rest are filtered out). I tried using variations of SUBTOTAL, but have not been able to solve my problem. Any thoughts?
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Well, I figured it out my dilemma shortly after my last post! I simply changed the if/then to an If/and/then and added "cl.rows.hidden = False." so now it reads

If Cell.Interior.Index = ColorIndexNumber And cl.Rows.Hidden = False _

I suppose one could also add a third condition if wanting to count visible columns as well. That would be cl.Columns.Hidden = False

Great Site...so much valuable info here!
 
Upvote 0

Forum statistics

Threads
1,224,801
Messages
6,181,047
Members
453,014
Latest member
Chris258

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