ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to count number of cells in a color ? (https://www.excelbanter.com/excel-discussion-misc-queries/47072-how-count-number-cells-color.html)

Francisco

how to count number of cells in a color ?
 
I have a list of data in column, they have conditioanal format to different
colors, e.g. blue, red, brown. I want to count the total number of blue.
How to do it ? The "CountIf" function does seem to help. Any suggestions ?
Thanks.

Ron de Bruin

Hi Francisco

See
http://www.cpearson.com/excel/CFColors.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Francisco" wrote in message ...
I have a list of data in column, they have conditioanal format to different
colors, e.g. blue, red, brown. I want to count the total number of blue.
How to do it ? The "CountIf" function does seem to help. Any suggestions ?
Thanks.




paul

why dont you count/test for the same condition that you use for the
formatting itself.....
--
paul
remove nospam for email addy!



"Francisco" wrote:

I have a list of data in column, they have conditioanal format to different
colors, e.g. blue, red, brown. I want to count the total number of blue.
How to do it ? The "CountIf" function does seem to help. Any suggestions ?
Thanks.


Jack Sons

Francisco,

I once found this in the NG, I believe.

Jack Sons
The Netherlands

Sub SumColorCountYellow()
Dim Yellow6 As Integer
Dim Cell As Range

For Each Cell In Range("DataY")
If Cell.Interior.ColorIndex = 6 Then
Yellow6 = Yellow6 + Cell.Value
End If
Next
originalF = Range("F1").Value
Range("F1").Value = "Yellow = " & Yellow6

MsgBox " Yellow adds to " & Yellow6, _
vbOKOnly, "CountColor"

Range("F1").Value = originalF '""
End Sub


"Francisco" schreef in bericht
...
I have a list of data in column, they have conditioanal format to different
colors, e.g. blue, red, brown. I want to count the total number of blue.
How to do it ? The "CountIf" function does seem to help. Any suggestions
?
Thanks.




Dave Peterson

This works if you used Format|Cells to change the color.

But it won't work with format|Conditional formatting.

Jack Sons wrote:

Francisco,

I once found this in the NG, I believe.

Jack Sons
The Netherlands

Sub SumColorCountYellow()
Dim Yellow6 As Integer
Dim Cell As Range

For Each Cell In Range("DataY")
If Cell.Interior.ColorIndex = 6 Then
Yellow6 = Yellow6 + Cell.Value
End If
Next
originalF = Range("F1").Value
Range("F1").Value = "Yellow = " & Yellow6

MsgBox " Yellow adds to " & Yellow6, _
vbOKOnly, "CountColor"

Range("F1").Value = originalF '""
End Sub

"Francisco" schreef in bericht
...
I have a list of data in column, they have conditioanal format to different
colors, e.g. blue, red, brown. I want to count the total number of blue.
How to do it ? The "CountIf" function does seem to help. Any suggestions
?
Thanks.


--

Dave Peterson


All times are GMT +1. The time now is 06:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com