![]() |
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" |
sum up values at intervals
Melissa,
Put this in C1 =B1 and this in C2 =IF(A2=A1,B2+C1,B2) Drag C2 down as fae as required. Mike "Melissa" wrote: 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" |
All times are GMT +1. The time now is 12:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com