Counting Color Cells

danjw_98

Active Member
Joined
Oct 25, 2003
Messages
354
I tried to use the "=CountIfColor(a1:a10,3) to count the number of red filled cells and it doesn't seem to work - it shows "#name?" in the cell that I have this in.

any suggestions?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Well I know for a fact that it does work so you've done something wrong...
 
Upvote 0
danjw_98 said:
I tried to use the "=CountIfColor(a1:a10,3) to count the number of red filled cells and it doesn't seem to work - it shows "#name?" in the cell that I have this in.

any suggestions?

What is the CountIfColor function - is it an add-in or your own UDF? Chip Pearsons site is really good and I agree with Iridium that it works just fine.

If you want a quick & dirty way to count the colours you can use this. Theres no error checking.

Code:
Sub CountColours()
Dim q1 As Range, q2 As Range, MyColour, c, I As Integer

Set q1 = Application.InputBox("Click on a cell that has the colour you want to count", _
"select Colour", , , , , , 8)

MyColour = q1.Interior.ColorIndex

Set q2 = Application.InputBox("Select the range to look in", _
"Range to count colour", , , , , , 8)

I = 0

For Each c In q2
If c.Interior.ColorIndex = MyColour Then
I = I + 1
End If
Next c

MsgBox "There are " & I & " cells in the range that match your colour"

End Sub

hth
 
Upvote 0
I entered the "countifcolor(a1:a10,3)" as a formula in cell a12 and i get the #name? in cell a12, I also tried "countbycolor(a1:a10,3)" with the same results. What am i doing wrong?
 
Upvote 0
There is not a function in Excel "COUNTIFCOLOR". The #NAME says that the formula name is not valid. What happened when you used the suggestion from Chip Pearson's site?

Please give us more info
texasalynn
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,028
Members
449,092
Latest member
ikke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top