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:

Value AValue BA + BRequired Result
0-2000-20000
0-3500-35000
41000-110003000030000
0-1600-160028400
0-1800-180026600
0-11800-1180014800
0-6000-60008800
0-10000-10000-1200
0-5000-50000
20000-50001500015000
0-8000-80007000
0-5000-50002000
0-6500-6500-4500
0-3300-33000
0-9800-98000
0-5300-53000

<tbody>
</tbody>
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!
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
8,818
Office Version
2007
Platform
Windows
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>
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
8,818
Office Version
2007
Platform
Windows
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))
 

Neil_R

New Member
Joined
Jun 18, 2019
Messages
5
Re: Running Total reset by negsative value

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

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
8,818
Office Version
2007
Platform
Windows
Re: Running Total reset by negsative value

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

Forum statistics

Threads
1,081,983
Messages
5,362,548
Members
400,679
Latest member
alecalec202

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top