Hello,
I've been at this for about two hours and can't figure it out.

Here's what I'm trying to accomplish- I have items that are color coded (by font color, they cannot be color coded by background color)- I need to obtain both the count and sum of these times based on their font color.

I've been trying to use this code (that I got from Ozgrid.com
(Code)
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 SUM = True Then

For Each rCell In rRange

If rCell.Interior.ColorIndex = lCol Then

vResult = WorksheetFunction.SUM(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
(/Code)

I've been trying to use the above VBA code with these formulas:
=ColorFunction($C$1,$A$1:$A$12,TRUE) (to get SUM)
=ColorFunction($C$1,$A$1:$A$12,FALSE) (to get COUNT)

I've tried changing the word "interior" to "font", with mixed results- it seems like each time I try it, I get accurate numbers for ONLY green font or ONLY Red font (the other color will contain numbers I can't make sense of). I've also tried replacing "FontIndex" with "Font".

If it's easier, I'd be happy to code sum they by Index Code 10 (Green) and Index Code 3 (Red). There will be items that are black font, but I do not need totals from them.

Does anyone know why this wouldn't work, or know a method I can use instead? I tried a method that used Application.Volatile, but it slowed down my code significantly.

Thanks in advance,

Chad