Fill values for formula

G

gardener

I am trying to write a formula that will do the following: if a cell i
fill in with color, do not sum values, otherwise sum values. However
I do not know what the fill variable is to put in the formula. Hop
this make sense. Please help.

Thank You
 
J

Jazzer

Hi,

Function SumIfFilled(rArea As Range) As Double
Dim r As Range

Application.Volatile

For Each r In rArea
If r.Interior.ColorIndex = xlNone Then
SumIfFilled = SumIfFilled + r.Value
End If
Next
End Function


This should do the trick. Remember that allthough this is marked as
volatile, the changing of fill color doesn't automatically recalculate
the value of this function. You should either change some value on the
worksheet or press F9 to recalculate this function.

- Asser
 
Top