+ Reply to Thread
Results 1 to 12 of 12

Need a formula for running total to reset at zero

  1. #1
    Registered User
    Join Date
    04-23-2014
    Location
    North Charleston, SC
    MS-Off Ver
    Excel2013
    Posts
    6

    Need a formula for running total to reset at zero

    I need help with a formula to keep a running total from each month unless a "zero" occurs. Then it would reset and begin counting over again.
    I have attached a sample file.
    Attached Files Attached Files

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Need a formula for running total to reset at zero

    Which cells are your desired output and how to calculate?
    Quang PT

  3. #3
    Registered User
    Join Date
    04-23-2014
    Location
    North Charleston, SC
    MS-Off Ver
    Excel2013
    Posts
    6

    Re: Need a formula for running total to reset at zero

    The desired output would be in column C.

    For example, A. Green on line 2, current has a "0" because he has no duty scheduled in April. That's why the current total is "0" in C2. Hope I am answering correctly. I appreciate your help!

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Need a formula for running total to reset at zero

    How we can know April is used? Is it the previous month of current month (May)?

  5. #5
    Registered User
    Join Date
    04-23-2014
    Location
    North Charleston, SC
    MS-Off Ver
    Excel2013
    Posts
    6

    Re: Need a formula for running total to reset at zero

    This was done up until April. We could enter a physical "0" if that makes things work better. I am very open to rearranging this etc...

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need a formula for running total to reset at zero

    First I set up a defined name.
    With the active cell in row 2, Go to Name Manager and
    CurrRng = =Officer!$D2:INDEX(Officer!$D2:$N2,MATCH(TEXT(EOMONTH(TODAY(),-1),"mmm"),Officer!$D$1:$N$1,0))

    Then you'll need Arrayed Formulas
    In C2 copied down
    =IFERROR(SUM(INDEX(CurrRng,MATCH(2,1/ISBLANK(CurrRng))):$F2),SUM($D2:INDEX($D2:$N2,MATCH(TEXT(EOMONTH(TODAY(),-1),"mmm"),$D$1:$N$1,0))))

    For arrayed formulas
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Registered User
    Join Date
    04-23-2014
    Location
    North Charleston, SC
    MS-Off Ver
    Excel2013
    Posts
    6

    Re: Need a formula for running total to reset at zero

    Thanks so much for your response as well ChemistB. However, it doesn't appear to work correctly. If testing it and entering a "0" in cell F2 (April), the total should change to a "0". If there ever is a 0, the total should start over at zero and start counting over again.

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need a formula for running total to reset at zero

    Yes, my formula works on blanks, not zeros.

  9. #9
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need a formula for running total to reset at zero

    Here is the formula modified for 0 instead of blanks
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    04-23-2014
    Location
    North Charleston, SC
    MS-Off Ver
    Excel2013
    Posts
    6

    Re: Need a formula for running total to reset at zero

    It looks like it works great until it encounters a zero because it doesn't start over again with the next month unless you enter the formula and create an array. Do you need to do that every month? Otherwise, it appears very close to working.
    I want to try and get it to work without having to update the formula monthly though. Unless I am missing something, when you go to enter a number in the column for May (G2) it will only start over if I update the formula and press "Ctrl,Shift,Enter" and then it appears to work. So is that how I would use it each month? Sorry for the questions, but its probably user error on my end. Thanks for your patience and help.

  11. #11
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need a formula for running total to reset at zero

    The formula is set up (hopefully) to work from the previous month so since it's May, it works through April. On June 1, it will work through May. That's the whole defined name TEXT(EOMONTH(TODAY(),-1),"mmm") part. I assumed you would put in numbers at the beginning of the next month. So, unless you change your computer clock, it's hard to test.

  12. #12
    Registered User
    Join Date
    04-23-2014
    Location
    North Charleston, SC
    MS-Off Ver
    Excel2013
    Posts
    6

    Re: Need a formula for running total to reset at zero

    Oh, I see! Ok. Thanks so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Running total formula
    By Cms040889 in forum Excel General
    Replies: 2
    Last Post: 07-13-2012, 12:33 PM
  2. Replies: 1
    Last Post: 05-09-2012, 04:32 PM
  3. Running total reset by zero
    By flyp in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-21-2011, 06:49 PM
  4. Running Total Formula
    By beets in forum Excel General
    Replies: 2
    Last Post: 09-14-2009, 01:48 PM
  5. Formula for running total
    By santaviga in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-27-2006, 05:50 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1