You could try to filter your data and then enter your formula as a subtotal. You would need to distinquish each group of L's spearately in column I.
Alternatively, you could use some VBA code to run the cumulative sums between the W values.
Excel Spreadsheet:
I
J
K
L
1
2
L
5
7.5
7.5
3
L
11.25
13.75
21.25
4
W
-
-
5
L
3.75
6.25
6.25
6
Assuming you wanted to sum on column K you could select the cells in column L and run the following VBA code:
VBA Code:
Sub Sum_I() Dim tempsum As Single Dim a As Variant tempsum = 0 For Each a In Selection If Trim(a.Offset(0, -3).Value) = "L" Then tempsum = tempsum + a.Offset(0, -1).Value a.Formula = tempsum Else tempsum = 0 End If Next a End Sub