View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Glenn Glenn is offline
external usenet poster
 
Posts: 1
Default Count if - background colour & value

I'm trying to count cells which have a certain background
colour, but which also have a specific value.

I'm able to count background colour using this:

For Each Rng In inrange.Cells
'' If activecell.value <= 52 Then "this bit doesn't work"
If OfText = True Then
CountbyColour = CountbyColour - (Rng.Interior.ColorIndex
= 38)
Else
'nothing
End If
Next Rng
End Function

But i can't get the function to work if i addin the
condition of cell value, as well as background colour.

I've also tried leaving the criteria out of the function
and enforcing the criteria in the cell by using
=IF(A1:B10 <=52,countbycolour(A1:B10,38,TRUE),"0")

But it ignores the "<= 52" bit

Any suggestions would be much appreciated.

Glenn