Hi there,

How do I alter the colourfunction module to allow me to count the values for more than one color in a range?

Formula: copy to clipboard
Function ColorFunction(Colour As Range, Range As Range)
Dim rCell As Range
Dim lCol As Long
Dim vResult

lCol = Colour.Interior.ColorIndex

If SUM = True Then
For Each rCell In Range
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell) + vResult
End If
Next rCell
Else
For Each rCell In Range
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell) + vResult
End If
Next rCell
End If

ColorFunction = vResult

End Function