Count If a certain cell color meets a certain criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to count the number of cells that have a certain interior color criteria that all have the contain the same text. Does anyone know how to do this with formulas?
 
Thanks I found it in the WEB site. Do you happen to know how to change it in to a formula? This formula =COUNTBYCOLOR(A1:A10,3,FALSE) gives me a result of $NAME?

Or can you decipher this

Function CountByColor(InRange As Range, WhatColorIndex As
Integer, Optional OfText As Boolean = False) As Lon

' This function return the number of cells in InRange with
' a background color, or if OfText is True a font color,
' equal to WhatColorIndex

Dim Rng As Rang
Application.Volatile Tru

For Each Rng In InRange.Cell
If OfText = True The
CountByColor = CountByColor - _
(Rng.Font.ColorIndex = WhatColorIndex
Els
CountByColor = CountByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex
End I
Next Rn

End Function
 
Back
Top