JPB,
Enter the code below in to a codemodule, and use it like:
=SpSum(A1:A150,B1:B150,"V",30)
HTH,
Bernie
MS Excel MVP
Function SpSum(R1 As Range, _
R2 As Range, _
Ignore As String, _
Pop As Integer) As Double
Dim myRow As Long
Dim myCount As Integer
myCount = 0
SpSum = 0
For myRow = R2(R2.Cells.Count).Row To 1 Step -1
If R1(myRow).Value <> Ignore Then
SpSum = SpSum + R2(myRow).Value
myCount = myCount + 1
If myCount = Pop Then Exit Function
End If
Next myRow
End Function
>I made some metacode how it should look like but I need more VBA help
>
[quoted text clipped - 17 lines]
>
> End If CounterDay=365