Re: Conditional count based on cell value and color
The user colors the cell as needed.
I use a function to count the cells that are set to whatever color i need.
Here is the color counting function:
Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult
lCol = rColor.Interior.ColorIndex
If Count = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.Count(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If
ColorFunction = vResult
End Function
I use this to count the cells with the correct part # =COUNTIFS('4-21-11'!H:H,"=102688-01")
But I cant figure out how to make the cell color and the part # both the conditions to count.