I'm using a custom function called ColorFunction which I found on the internet to sum the values in a range of cells if the background colour is the same as another cell.
This is what is in the cell that shows the total.
=ColorFunction($AE$3,$B$3:$W$3,TRUE)
And the ColorFunction is as below.
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
This all works fine. However some of the values I'm using there is an * in them after the number value. For my other cells that I sum up these values in I use the following.
=SUMPRODUCT(VALUE(0&SUBSTITUTE(B3:W3,"*","")))
Is there any way I can do this with the ColorFunction to ignore the * in the cells when summing up the cells with a colour in them.
Thanks in advance.