MS Excel - 基于另一列中的“id 值”的列的累积总和?

Ten*_*ttu 4 worksheet-function microsoft-excel microsoft-excel-2010

我一直试图弄清楚如何制作一个公式,根据另一列中的 id 值计算一列中行的累积总和,但仍然没有找到任何解决方案。我试着用这些例子来证明我的意思:

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)
Run Code Online (Sandbox Code Playgroud)

依此类推,这是另一个包含更多条目和数字的示例(在“Excel 视图”中):

  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)
Run Code Online (Sandbox Code Playgroud)

我将永远感激这个公式解决方案!

Mát*_*ász 7

您需要将 sumif 与设置良好的引用一起使用,将其输入到 C1 并填写:=SUMIF($A$1:A1,A1,$B$1:B1)