Reputation: 323
I'm trying to create a formula that does a sum of column B until there is any change in column A. E.g.
Col A Col B
1 X 2
2 X 1
3 X 0
4 X 2
5 Y 1
Starting at the point of A1, this would then show the sum of 5. Column A in this situation would always be sorted (X, followed by Y, followed by Z etc.)
Upvotes: 2
Views: 10022
Reputation: 27
I guess this question is long ago answered, but I'd like to share my solution;
Like @Gary's Student showed, i suggest a similar way. You could also go with a IF
+ SUMIF
With data in cols A and B, in C2 enter:
=IF(A2<>A3,SUMIF(A:A,A2,B:B),"")
OBS.: The data needs to be sorted before using the formula.
I hope it help other people!
Upvotes: 2
Reputation: 96781
With data in cols A and B, in C2 enter:
=IF(A3<>A2,SUM($B$2:B2)-SUM($C$1:C1),"")
and copy down:
EDIT#1:
This approach requires:
Upvotes: 6