Running Total reset by negative value

Neil_R

New Member
Joined
Jun 18, 2019
Messages
5
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:

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]Value A[/TD]
[TD]Value B[/TD]
[TD]A + B[/TD]
[TD]Required Result[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-2000[/TD]
[TD]-2000[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-3500[/TD]
[TD]-3500[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]41000[/TD]
[TD]-11000[/TD]
[TD]30000[/TD]
[TD]30000[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-1600[/TD]
[TD]-1600[/TD]
[TD]28400[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-1800[/TD]
[TD]-1800[/TD]
[TD]26600[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-11800[/TD]
[TD]-11800[/TD]
[TD]14800[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-6000[/TD]
[TD]-6000[/TD]
[TD]8800[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-10000[/TD]
[TD]-10000[/TD]
[TD]-1200[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-5000[/TD]
[TD]-5000[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]20000[/TD]
[TD]-5000[/TD]
[TD]15000[/TD]
[TD]15000[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-8000[/TD]
[TD]-8000[/TD]
[TD]7000[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-5000[/TD]
[TD]-5000[/TD]
[TD]2000[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-6500[/TD]
[TD]-6500[/TD]
[TD]-4500[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-3300[/TD]
[TD]-3300[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-9800[/TD]
[TD]-9800[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]0[/TD]
[TD]-5300[/TD]
[TD]-5300[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]
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.

Any ideas are gratefully received!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Re: Running Total reset by negsative value

Try this

<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:76.04px;" /><col style="width:120.71px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td><td >D</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">Value A</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">Value B</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">A + B</td><td style="background-color:#ffff00; font-weight:bold; text-align:center; ">Required Result</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-2000</td><td style="text-align:right; ">-2000</td><td style="text-align:right; ">0</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-3500</td><td style="text-align:right; ">-3500</td><td style="text-align:right; ">0</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td style="text-align:right; ">41000</td><td style="text-align:right; ">-11000</td><td style="text-align:right; ">30000</td><td style="text-align:right; ">30000</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-1600</td><td style="text-align:right; ">-1600</td><td style="text-align:right; ">28400</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-1800</td><td style="text-align:right; ">-1800</td><td style="text-align:right; ">26600</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >7</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-11800</td><td style="text-align:right; ">-11800</td><td style="text-align:right; ">14800</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >8</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-6000</td><td style="text-align:right; ">-6000</td><td style="text-align:right; ">8800</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >9</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-10000</td><td style="text-align:right; ">-10000</td><td style="text-align:right; ">-1200</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >10</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-5000</td><td style="text-align:right; ">-5000</td><td style="text-align:right; ">0</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >11</td><td style="text-align:right; ">20000</td><td style="text-align:right; ">-5000</td><td style="text-align:right; ">15000</td><td style="text-align:right; ">15000</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >12</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-8000</td><td style="text-align:right; ">-8000</td><td style="text-align:right; ">7000</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >13</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-5000</td><td style="text-align:right; ">-5000</td><td style="text-align:right; ">2000</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >14</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-6500</td><td style="text-align:right; ">-6500</td><td style="text-align:right; ">-4500</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >15</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-3300</td><td style="text-align:right; ">-3300</td><td style="text-align:right; ">0</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >16</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-9800</td><td style="text-align:right; ">-9800</td><td style="text-align:right; ">0</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >17</td><td style="text-align:right; ">0</td><td style="text-align:right; ">-5300</td><td style="text-align:right; ">-5300</td><td style="text-align:right; ">0</td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >D2</td><td >=IF(AND(IFERROR(VALUE(D1),0)=0,C2<0),0,IF(D1>=0,D1+C2,0))</td></tr></table></td></tr></table>
 
Upvote 0
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))
 
Upvote 0
Re: Running Total reset by negsative value

And just like that, problem solved. Thanks, I was coming at it from the wrong angle!
 
Upvote 0
Re: Running Total reset by negsative value

I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,996
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top