View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Melissa Melissa is offline
external usenet poster
 
Posts: 122
Default sum up values at intervals

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"