Hi
Try this udf function
Function CountColorIf(ColorIndex As Long, rRange As Range, rCrit As Range, Optional SUM As Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult
If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = ColorIndex And rCell.Offset(0, -1) = rCrit Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = ColorIndex And rCell.Offset(0, -1) = rCrit Then
vResult = 1 + vResult
End If
Next rCell
End If
CountColorIf = vResult
End Function
In the attachment you will find help how to use it
Bookmarks