Count If a certain cell color meets a certain criteria

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?
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Count IF 6
countif and sumif 3
Counting cells with conditional formatting 3
Count IF 1
CountIf previous cell formula 0
Filler color 2
Counting and Suming based on multiple criteria 1
Count if if 1

Top