# Thread: Running Total reset by negative value Thanks: 0 Likes:  1 Post #5296031 (1)

1. ## Running Total reset by negative value

I am trying to setup a spreadsheet to track a number of values. I only need to create a running total when the total of 2 columns becomes a positive value and then track it back down to when it moves back to a negative. The data looks like this:

 Value A Value B A + B Required Result 0 -2000 -2000 0 0 -3500 -3500 0 41000 -11000 30000 30000 0 -1600 -1600 28400 0 -1800 -1800 26600 0 -11800 -11800 14800 0 -6000 -6000 8800 0 -10000 -10000 -1200 0 -5000 -5000 0 20000 -5000 15000 15000 0 -8000 -8000 7000 0 -5000 -5000 2000 0 -6500 -6500 -4500 0 -3300 -3300 0 0 -9800 -9800 0 0 -5300 -5300 0
I feel like there is an easy solution that I am just missing by nesting IF loops or something along those lines, I have tried with extra columns but I am missing something. Creating a running total isn't hard but having it reset is the problem.

2. ## Re: Running Total reset by negsative value

Try this

 A B C D 1 Value A Value B A + B Required Result 2 0 -2000 -2000 0 3 0 -3500 -3500 0 4 41000 -11000 30000 30000 5 0 -1600 -1600 28400 6 0 -1800 -1800 26600 7 0 -11800 -11800 14800 8 0 -6000 -6000 8800 9 0 -10000 -10000 -1200 10 0 -5000 -5000 0 11 20000 -5000 15000 15000 12 0 -8000 -8000 7000 13 0 -5000 -5000 2000 14 0 -6500 -6500 -4500 15 0 -3300 -3300 0 16 0 -9800 -9800 0 17 0 -5300 -5300 0

 Cell Formula D2 =IF(AND(IFERROR(VALUE(D1),0)=0,C2<0),0,IF(D1>=0,D1+C2,0))

3. ## Re: Running Total reset by negsative value

Edit:

Use this formula:

=IF(AND(IFERROR(VALUE(D1),0)=0,C2<0),0,IF(IFERROR(VALUE(D1),0)>=0,IFERROR(VALUE(D1),0)+C2,0))

4. ## Re: Running Total reset by negsative value

And just like that, problem solved. Thanks, I was coming at it from the wrong angle!