MS Excel - Cumulative sum of a column based on "id values" in another column?

4

4

I have been trying to figure out how to make a formula that calculates cumulative sums of rows in a column based on their id values in another column but still haven't found any solution for it. I try to demonstrate what I mean with these examples:

ID   Value   CumulativeCounter
1      2     (ID1 has 2)
2      3     (ID2 has 3)
3      1     (ID3 has 1)
4      5     (ID4 has 5)
1      9     (ID1 has the previous value 2 and this new 9 on top of that =11)
2      1     (ID2 has the previous value 3 and this new 1 on top of that =4)

And so on, here is another example (in "Excel view") with more entries and numbers:

  A  B  C
1 1  2  2
2 2  7  7
3 3  3  3
4 1  2  4 (<- 2+2)
5 5  9  9
6 1  2  6 (<- 4+2)
7 4  3  3
8 2  7  14
9 1  8  14 (<- 6+8)

I will be eternally grateful for a formula solution for this!

Tenttu

Posted 2015-04-15T09:51:02.950

Reputation: 180

Answers

6

You need to use sumif with well set references, enter this to C1 and fill down: =SUMIF($A$1:A1,A1,$B$1:B1).

Máté Juhász

Posted 2015-04-15T09:51:02.950

Reputation: 16 807

1This works perfectly! I can't believe it was that simple. I tried something like that (but obviously not the same) and it didn't work so I was convinced it would need some monstrous formula to achieve what I want. Thank you! :) – Tenttu – 2015-04-15T10:46:46.420