4

I saw a nice solution for the cumulative sum problem here: Cumulative Sum without Script

My question is how do you make this conditional? I mean cumulatively sum only numbers that belong to a certain username (string) in a separate column? I'd like to use arrayformula so cells autofill with data without dragging formula manually. E.g. running total for user A:

User   Amount   Running Total for A
A        1          1
B        2
A        4          5
A        3          8
B        5
A        2          10
6

If the data starts in row 2, then try:

=ArrayFormula(IF(A2:A="A",SUMIF(IF(A2:A="A",ROW(A2:A),ROWS(A:A)+1),"<="&ROW(A2:A),B2:B),))

  • You are a genius, thank you! Works like a charm. – komlos Sep 16 '14 at 15:26
  • Is there a way to make this formula work for all elements of column A?... I.e the conditional Running Total will work for a & b, and any other string a users puts into column A? – Xzila Dec 10 '15 at 18:05
  • @Xzila =ArrayFormula(IF(LEN(A2:A),SUMIF(IF(LEN(A2:A),ROW(A2:A),ROWS(A:A)+1),"<="&ROW(A2:A),B2:B),)) – AdamL Dec 10 '15 at 19:31
  • That totals everything. I meant where it has a separate running total for A, and B in the same column. In the original example the last row for User A should have a Running total of 10, and the last row for User B should have a Running total of 7. I asked a similar question to this one, that I've been trying to figure out: webapps.stackexchange.com/questions/87492/… – Xzila Dec 10 '15 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.