How to use nested IF statement with a running total?

Waimea

Active Member
Joined
Jun 30, 2018
Messages
465
Office Version
  1. 365
Platform
  1. Windows
I am trying to use a nested IF statement but I can't get it to work.

Code:
[TABLE="width: 530"]
<tbody>[TR]
[TD]Year[/TD]
[TD="align: right"]2012[/TD]
[TD="align: right"]2013[/TD]
[TD="align: right"]2014[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]2016[/TD]
[TD="align: right"]2017[/TD]
[/TR]
[TR]
[TD]Amount[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]34[/TD]
[TD="align: right"]54[/TD]
[TD="align: right"]67[/TD]
[TD="align: right"]88[/TD]
[/TR]
[TR]
[TD][B]Running total[/B][/TD]
[TD][/TD]
[TD="align: right"][B]0[/B][/TD]
[TD="align: right"][B]0[/B][/TD]
[TD="align: right"][B]2[/B][/TD]
[TD="align: right"][B]3[/B][/TD]
[TD="align: right"][B]4[/B][/TD]
[/TR]
</tbody>[/TABLE]

In cell H34 (running total for 2013 = 0):

Code:
=IF(G34<>0;0;
  IF(G33+H33>50;1;
  IF(H33+G33>70;2;
  IF(H33+G33>150;3;
  IF(H33+G33>210;4;0)))))

If the running total is 1,2,3 or 4 I want it to ignore the previous amount and then start over with a new count of amount.

Code:
[TABLE="width: 530"]
<tbody>[TR]
[TD]Year[/TD]
[TD="align: right"]2012[/TD]
[TD="align: right"]2013[/TD]
[TD="align: right"]2014[/TD]
[TD="align: right"]2015[/TD]
[TD="align: right"]2016[/TD]
[TD="align: right"]2017[/TD]
[/TR]
[TR]
[TD]Amount[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]34[/TD]
[TD="align: right"]54[/TD]
[TD="align: right"]67[/TD]
[TD="align: right"]88[/TD]
[/TR]
[TR]
[TD][B]Running total[/B][/TD]
[TD][/TD]
[TD="align: right"][B]0[/B][/TD]
[TD="align: right"][B]0[/B][/TD]
[TD="align: right"][B]1[/B][/TD]
[TD="align: right"][B]0[/B][/TD]
[TD="align: right"][B]2[/B][/TD]
[/TR]
</tbody>[/TABLE]


Ex.

If the amount of 2013 and 2014 is below 50 I want to have a 0 in running total.

If the amount of 2013 and 2014 is higher then 50-100 I want to have a 1 in running total.

if the amount of 2013 and 2014 is higher then 101-140 I want to have a 2 in running total.

If the amount of 2013 and 2014 is higher then 141 to 210 I want to have a 3 in running total. Anything above will be a 4.

But if the previous running total was 1,2,3 or 4 I want to reset the count. So if running total for 2015 was 3, I want the count for 2016 to ignore the previous amount. So that the running total doesn't say 2,3,4 etc.

I am not sure how to make it work?
 
Hi jasonb75,

thank you for your reply! I am trying your formula now and I think it does what I want.

Thank you for your help!
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,223,886
Messages
6,175,194
Members
452,616
Latest member
intern444

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