Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I have a list of percentages that are conditionally formatted and I want to
be able to count how many cells are each different colour. I don't think you can do this with count if as it only looks for numbers or text and not formatting but essentially I want to count the number of cells in a range which are red/gold or green. |
#2
![]() |
|||
|
|||
![]()
Use the following UDF
Function CountColor(rng As Range, colorRng As Range) For Each cl In rng If cl.Interior.ColorIndex = colorRng.Interior.ColorIndex Then ' use this for background color CountColor = CountColor + 1 End If Next End Function Usage =countcolor(A1:A10,A1) A1:A10 is the range for which you want to count, and A1 is the cell which has the desired color format which you want as criteria Mangesh "amvena" wrote in message ... I have a list of percentages that are conditionally formatted and I want to be able to count how many cells are each different colour. I don't think you can do this with count if as it only looks for numbers or text and not formatting but essentially I want to count the number of cells in a range which are red/gold or green. |
#3
![]() |
|||
|
|||
![]()
This won't work for conditionally formatted cells. For that you need to test
whether it meets the CF condition. -- HTH RP (remove nothere from the email address if mailing direct) "Mangesh Yadav" wrote in message ... Use the following UDF Function CountColor(rng As Range, colorRng As Range) For Each cl In rng If cl.Interior.ColorIndex = colorRng.Interior.ColorIndex Then ' use this for background color CountColor = CountColor + 1 End If Next End Function Usage =countcolor(A1:A10,A1) A1:A10 is the range for which you want to count, and A1 is the cell which has the desired color format which you want as criteria Mangesh "amvena" wrote in message ... I have a list of percentages that are conditionally formatted and I want to be able to count how many cells are each different colour. I don't think you can do this with count if as it only looks for numbers or text and not formatting but essentially I want to count the number of cells in a range which are red/gold or green. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Counting cells with a specific background colour | Excel Discussion (Misc queries) | |||
Counting unique text/number cells from a range | Excel Discussion (Misc queries) | |||
Counting unique text/number cells from a range | Excel Worksheet Functions | |||
complex fomula: counting cells that are blank | Excel Worksheet Functions | |||
Counting blank cells in Pivot Table | Excel Worksheet Functions |