Similar to 6StringJazzer
First range is "Count Range", second range is "Base cell"
-See attached workbook for working examples (formulas in cells E4 to G5)
3 UDFs
Function COUNTFILLCOLOUR(myRng As Range, myCel As Range)
Dim cel As Range, fil As Long
For Each cel In myRng
If cel.Interior.Color = myCel.Interior.Color Then fil = fil + 1
Next cel
COUNTFILLCOLOUR = fil
End Function
Function COUNTFONTCOLOUR(myRng As Range, myCel As Range)
Dim cel As Range, fnt As Long
For Each cel In myRng
If cel.Font.Color = myCel.Font.Color Then fnt = fnt + 1
Next cel
COUNTFONTCOLOUR = fnt
End Function
Function COUNTBOTHCOLOURS(myRng As Range, myCel As Range)
Dim cel As Range, both As Long
For Each cel In myRng
If cel.Font.Color = myCel.Font.Color And cel.Interior.Color = myCel.Interior.Color Then both = both + 1
Next cel
COUNTBOTHCOLOURS = both
End Function
Bookmarks