sum up values at intervals

G

Guest

Hello!
What formula can I use in Col C in the example table below:
Row# Col A Col B Col C
1 X 1 1
2 Y 2 2
3 Y 1 3
4 X 1 1
5 X 1 2

Col C sums up the values in Col B based on Col A:
A1 = X therefore C1 sums B1:B1 to get "1"
A2 = Y therefore C2 sums B2:B2 to get "2"
A3 = Y. Since the row above is also "Y", C3 should sum B2:B3 to get "3"
A4 = X. Since this "breaks" the series of "Y", C4 should restart the
summing from this row, i.e. B4:B4 to get "1"
A5 = X. Since the row above is also "X", C5 should sum C4:C5 to get "2"
 
G

Guest

Melissa,

Put this in C1
=B1
and this in C2
=IF(A2=A1,B2+C1,B2)

Drag C2 down as fae as required.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top