ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Counting Cells with colors (https://www.excelbanter.com/excel-discussion-misc-queries/241230-counting-cells-colors.html)

JimW

Counting Cells with colors
 
Is there a formula that will count cells that contain different colors. Blank
with no data just colored.

Sean Timmons

Counting Cells with colors
 
Which version of Excel do you have?

"JimW" wrote:

Is there a formula that will count cells that contain different colors. Blank
with no data just colored.


JimW

Counting Cells with colors
 
2003

"Sean Timmons" wrote:

Which version of Excel do you have?

"JimW" wrote:

Is there a formula that will count cells that contain different colors. Blank
with no data just colored.


JimW

Counting Cells with colors
 
There might also be text in the cell but I want to count it based strictly on
the color

"Sean Timmons" wrote:

Which version of Excel do you have?

"JimW" wrote:

Is there a formula that will count cells that contain different colors. Blank
with no data just colored.


Sean Timmons

Counting Cells with colors
 
There is no built in function in Excel to do that, but there is a macro you
can use.

If you want it, you can do a search in the search for box with count color.

"JimW" wrote:

There might also be text in the cell but I want to count it based strictly on
the color

"Sean Timmons" wrote:

Which version of Excel do you have?

"JimW" wrote:

Is there a formula that will count cells that contain different colors. Blank
with no data just colored.


JimW

Counting Cells with colors
 
Or, you can buy "Colored Cells Assistant" only 29.95. I was hoping there was
another way.

"Sean Timmons" wrote:

There is no built in function in Excel to do that, but there is a macro you
can use.

If you want it, you can do a search in the search for box with count color.

"JimW" wrote:

There might also be text in the cell but I want to count it based strictly on
the color

"Sean Timmons" wrote:

Which version of Excel do you have?

"JimW" wrote:

Is there a formula that will count cells that contain different colors. Blank
with no data just colored.


L. Howard Kittle

Counting Cells with colors
 
I don't think you can do that with a formula. Here is some code that may be
tweeked to suit.

Sub ColorCount()
'Counts the number of colored
'cells in a range named Data.
Dim Blue5 As Integer
Dim Red3 As Integer
Dim Green4 As Integer
Dim Yellow6 As Integer
Dim Cell As Range

For Each Cell In Range("Data") '("B1:F11")
If Cell.Interior.ColorIndex = 5 Then
Blue5 = Blue5 + 1
ElseIf Cell.Interior.ColorIndex = 3 Then
Red3 = Red3 + 1
ElseIf Cell.Interior.ColorIndex = 4 Then
Green4 = Green4 + 1
ElseIf Cell.Interior.ColorIndex = 6 Then
Yellow6 = Yellow6 + 1
End If
Next

Range("A1").Value = Blue5 & " Blue"
Range("A2").Value = Red3 & " Red"
Range("A3").Value = Green4 & " Green"
Range("A4").Value = Yellow6 & " Yellow"

MsgBox " You have: " & vbCr _
& vbCr & " Blue " & Blue5 _
& vbCr & " Red " & Red3 _
& vbCr & " Green " & Green4 _
& vbCr & " Yellow " & Yellow6, _
vbOKOnly, "CountColor"
End Sub

HTH
Regards,
Howard

"JimW" wrote in message
...
Is there a formula that will count cells that contain different colors.
Blank
with no data just colored.




Chip Pearson

Counting Cells with colors
 
I have lots of code, including a count by color function, at
www.cpearson.com/Excel/Colors.aspx

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Mon, 31 Aug 2009 12:56:02 -0700, JimW
wrote:

Is there a formula that will count cells that contain different colors. Blank
with no data just colored.



All times are GMT +1. The time now is 04:19 AM.

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