Log in

View Full Version : Excel - Count how many cells have a certain color


vegas2797
Sep 5, 2008, 08:57 AM
Is there a formula to count how many cells within a row have a certain color. For Instance if I have A1 to M1 filled in with text and 8 are colored yellow then I want my result in N1 to say 8. Any way to do this?

JBeaucaire
Sep 5, 2008, 10:11 AM
Which version of Excel are you on? Must include info like that in this forum!

For Office 2003, there is no function, you will need some VB code to create a new function that you can then use in your formulas. I've done this exact thing using the following page... it works perfectly!

Sum/Count Cells By Fill Or Background Color in Excel (http://www.ozgrid.com/VBA/sum-count-cells-by-color.htm)

This page shows the same thing in a similar way, but it's much briefer... which may be bad if this all sounds greek to you.
http://www.exceltip.com/st/Count_by_color_using_VBA_in_Microsoft_Excel/518.html

In Office 2007, I believe there is a simple way already built in...