try this macro:
Function SumColor(rColor As Range, rSumRange As Range)
Dim rCell As Range
Dim iCol As Integer
Dim vResult
iCol = rColor.Interior.ColorIndex
For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = WorksheetFunction.Sum(rCell) + vResult
End If
Next rCell
SumColor = vResult
End Function
Method:
Go to tools> Macro> visual Basic Editor and go Insert>Module and paste in the code. Press Alt+Q and save. The Function will appear under "User Defined" in the Paste Function (Shift+F3).
RColor is the color you want to sum
RSumRange is the range you want to sum
through
I think this should solve your problem