-1

I have the following 2-column table:

Threshold  Duration
1          1
1          2
1          1
0          1
0          2
1          1
1          3

I would like to create a column with running total of 'Duration' column which would start from 0 whenever the value of 'Threshold' column changes i.e.:

Threshold  Duration  Total 
1          1         1
1          2         3
1          1         4
0          1         1
0          2         3
1          1         1
1          3         4

Thanks

Blazej Kowalski
  • 367
  • 1
  • 6
  • 16

2 Answers2

2

This formula should do the trick:

=IF(A2<>A1,B2,B2+C1)

For example, with your sample data laid out as below:

img

ashleedawg
  • 20,365
  • 9
  • 72
  • 105
0

I think Ashleedawh got this right and did a better answer than me. I quickly was working on my own solution and will provide it anyway, just so you can see a little bit of variation.

Threshold Duration Total Formula I used 1 1 1 =C3 1 2 3 =IF(B4-B3<>0,C4,D3+C4) 1 1 4 =IF(B5-B4<>0,C5,D4+C5) 0 1 1 =IF(B6-B5<>0,C6,D5+C6) 0 2 3 etc.... use click and drag.... 1 1 1 1 3 4

for my version to work I had to make a specific formula in the first row of '=C3' the used a similar formula to Ashlee's above.

Just thought I would post to see if it also helps.... Here is a screen capture of my work, I stated in Cell B2 - so the word Threshold is in cell B2.

Screen Capture Link

Pete
  • 23
  • 2
  • 8