+ Reply to Thread
Results 1 to 10 of 10

Reset SUM at the end of the month

  1. #1
    Registered User
    Join Date
    03-20-2023
    Location
    Croatia
    MS-Off Ver
    Software Microsoft Office 2021 Home & Student
    Posts
    12

    Cool Reset SUM at the end of the month

    Hi all.

    Is there a way to reset sum at the end of the month? I have 3 columns: date, quantity for the date and total. I'd like the total to reset at the end of the month and start over. Please take a look at the attachement.Running total resets.xlsx

    Thanks.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,829

    Re: Reset SUM at the end of the month

    You could use this formula in D2:

    =SUM(C2,IF(COUNTIF(A$2:A2,LEFT(A2,8)&"*")=1,0,D1))

    Copy down as required.

    Note that your dates are text values for me, as . is not recognised as a date separator in my regional settings.

    Note also that you may need to use semicolons ( ; ) in the formula rather than commas ( , ).

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    03-20-2023
    Location
    Croatia
    MS-Off Ver
    Software Microsoft Office 2021 Home & Student
    Posts
    12

    Re: Reset SUM at the end of the month

    Thanks for your reply, Pete.

    Can you breakdown your formula? Where do I input begginning and the end of the month?

    Thanks.

  4. #4
    Registered User
    Join Date
    03-20-2023
    Location
    Croatia
    MS-Off Ver
    Software Microsoft Office 2021 Home & Student
    Posts
    12

    Re: Reset SUM at the end of the month

    What do I do if I need to change the reset at the end of the day?

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,829

    Re: Reset SUM at the end of the month

    The year and month is derived by the expression:

    LEFT(A2,8)

    within the COUNTIF function. This is then compared with the range A$2:A2 - note that this is a variable range which changes as the formula ic copied down, to A$2:A3, A$2:A4, and so on. If the COUNTIF function results in 1, then this (row) must be the first one in which that year and month occur, and so zero will be added on to the value in column C, but for all other dates the cumulative value in column D will be added to the value from column C, and thus this reset the sum at the start of each month.

    Hope this helps.

    Pete

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,829

    Re: Reset SUM at the end of the month

    Quote Originally Posted by mixers99 View Post
    What do I do if I need to change the reset at the end of the day?
    In that case you don't need to have the LEFT function - you can do this instead:

    =SUM(C2,IF(COUNTIF(A$2:A2,A2)=1,0,D1))

    Hope this helps.

    Pete

  7. #7
    Registered User
    Join Date
    03-20-2023
    Location
    Croatia
    MS-Off Ver
    Software Microsoft Office 2021 Home & Student
    Posts
    12

    Re: Reset SUM at the end of the month

    Quote Originally Posted by Pete_UK View Post
    In that case you don't need to have the LEFT function - you can do this instead:

    =SUM(C2,IF(COUNTIF(A$2:A2,A2)=1,0,D1))

    Hope this helps.

    Pete
    Wow, this is exactly what I needed. Thank you so much. If I could pick your brain a little more: what if I wanted to remove first 4 rows from calculation in each day? Is that possible?

    Thanks again!

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,829

    Re: Reset SUM at the end of the month

    You could use this formula in E2:

    =SUM(IF(COUNTIF(A$2:A2,A2)<=4,0,C2),IF(COUNTIF(A$2:A2,A2)<=4,0,E1))

    Note that I put it in column E for direct comparison with column D. If you want to put it in D2 you will need to change the E1 (shown in red) to D1.

    Hope this helps.

    Pete

  9. #9
    Registered User
    Join Date
    03-20-2023
    Location
    Croatia
    MS-Off Ver
    Software Microsoft Office 2021 Home & Student
    Posts
    12

    Re: Reset SUM at the end of the month

    Thank you so much for your help,Pete!

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,829

    Re: Reset SUM at the end of the month

    Glad to help, and thanks for marking the thread as Solved.

    In addition, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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. [SOLVED] Reset all day and month values to January 1 in dd/mm/yyyy format
    By Nora Murph in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-10-2022, 01:48 AM
  2. Replies: 1
    Last Post: 05-18-2019, 10:31 AM
  3. Replies: 4
    Last Post: 12-20-2018, 12:11 AM
  4. [SOLVED] I need to create a reset button that will reset rows containing a specific value
    By odin78 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-03-2016, 02:11 PM
  5. [SOLVED] How to reset a field number to 1 at the beginning of each month.
    By SGT in forum Access Tables & Databases
    Replies: 5
    Last Post: 10-03-2014, 03:43 AM
  6. reset cell to zero at end of month
    By wcolagator in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-02-2012, 12:17 PM
  7. Month to date sales - reset in new month???
    By [email protected] in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-26-2005, 04:25 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