Forum Discussion
jklei1895
Feb 13, 2022Copper Contributor
Count if color
Trying to use countifcolor function and its not listed in my excel functions. Using Microsoft 365, ver 2201 What do I need to do?
NikolinoDE
Feb 13, 2022Platinum Contributor
I don't know if this is possible in your version, but one approach would be to do this with VBA. Otherwise, as Mr. Baklan has already informed 🙂
Count the number of cells with a specific cell color using VBA
Here is the example for red cells.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim anzahl As Long
Dim Zelle As Range
anzahl = 0
For Each Zelle In Range("E1:E100")
If Zelle.Interior.ColorIndex = 3 Then
anzahl = anzahl + 1
End If
Next Zelle
Cells(6, 6).Value = anzahl
End Sub
Hope I was able to help you with this info.
I know I don't know anything (Socrates)