Counting of cells with a specific color filled
There is no built-in excel function to do this. But you can use a UDF that
looks at the range and returns the sum of color. But that function will not
recalculate if you change color. Every time you change the color you will
need to recalculate or wait excel to recalculate...
To install the UDF (User Defined function). From workbook launch VBE using
Alt+F11. From menu Insert a Module and paste the below function.Close and get
back to workbook and try the below formula.
Function COLORCOUNT(varRange As Range, varColor As Range)
Dim cell As Range
For Each cell In varRange
If cell.Interior.ColorIndex = varColor.Interior.ColorIndex Then
ColorCount = ColorCount + 1
End If
Next
End Function
ITo use the as a formula in range A1:A10 try the below; which will count the
number of blue cells....The second argument denotes the colored cell.
=COLORCOUNT(A1:A10,B1)
--
Jacob
"Atiq" wrote:
Hello experts,
I have an excel workhseet where different cells are filled with different
colors. I need to count no of cells in a specific column with a specific
colour filled. For example i need to count how many cells are filled with
green color and how many with red etc. What formula i should use?
Thanks in advance,
Atiq
|