Reputation: 1
I am trying to sum a column A based on a value in column B, but I only want to sum the values until I reach a different criteria value (in column B). When I reach that value, I want to reset the function & repeat.
A | B | Sum Value I'm looking for |
---|---|---|
12 | N/A | 12 |
34 | N/A | 46 |
21 | N/A | 67 |
45 | BREAK | 109 |
232 | N/A | 232 |
64 | N/A | 296 |
231 | BREAK | 527 |
423 | BREAK | 423 |
46 | N/A | 46 |
4 | N/A | 50 |
56 | N/A | 106 |
86 | N/A | 192 |
235 | N/A | 427 |
463 | BREAK | 890 |
3 | N/A | 3 |
57 | N/A | 60 |
75 | BREAK | 135 |
I have tried SUMIF but cannot get this to work. Any help would be greatly appreciated.
Thank you!
Upvotes: 0
Views: 119
Reputation: 17501
I've started using this formula (in cell C2):
=IF(B2="BREAK";A3;C2+A3)
This is not entirely correct, but it gives another idea: in order to repeat the calculation of the whole sum, you do this in an cumulative manner (first you get A2+A3 (which you put in cell C2), then A2+A3+A4 (which you put in cell C3), ...).
Upvotes: 2
Reputation: 6398
The following formula should work:
=SUM(A$2:A2)-SUMIF(B$1:B1,"BREAK",C$1:C1)
And populate down
Upvotes: 3