+ Reply to Thread
Results 1 to 12 of 12

running countif a cell reaches a certain total

  1. #1
    Registered User
    Join Date
    11-12-2019
    Location
    Ottawa
    MS-Off Ver
    2016
    Posts
    9

    running countif a cell reaches a certain total

    Hi Guys,

    Im trying to make a spreadsheet to keep track of float variances for employees. The way the policy works is as follows: We keep track of an employees daily variances and keep a rolling balance (after 30 days old variances fall off the running total). If the the rolling balance hits $50 they receive an "occurrence". The tricky part is that once they hit the $50 mark and they receive their occurrence we subtract $50 from the rolling balance and start over. So say they have variances of $10, $23, $9 and $22 in a 30 day period they would have a rolling balance of $64. We would add an occurrence to their file and their rolling balance would become $14. Ive tried using a countif formula but Im running into issues when we reset the balance(Ie I add +1 to occurrence_level if variance >=50, but once we subtract the $50 this statement is no longer true and the occurrence level goes back to 0) Is there an easy way to keep a running count of occurrences even after we reset the balance? Im guessing I have to use a helper cell or macro, but the solution is escaping me!

    Any help would be appreciated.


    Ive edited my original post to include a sample excel spreadsheet. I have also included a picture of a flow chart to help people understand the end goal.

    Thanks
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by ageoffools; 11-12-2019 at 08:46 AM.

  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,728

    Re: running countif a cell reaches a certain total

    It would help if you attached a sample Excel workbook, rather than a picture of one.

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post.

    Don't try to use the Paperclip icon for attachments, as it doesn't work on this forum.

    Hope this helps.

    Pete

    Pete

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: running countif a cell reaches a certain total

    Please read the yellow banner at the top of the page and atttach the file.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    11-12-2019
    Location
    Ottawa
    MS-Off Ver
    2016
    Posts
    9

    Re: running countif a cell reaches a certain total

    Thanks I believe I have attached it now.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,563

    Re: running countif a cell reaches a certain total

    This proposal employs two helper columns (C:D) which may be moved and/or hidden for aesthetic purposes.
    Paste the following into cell C4: =IF(B4="","",IF(SUM(C3,B4)>50,SUM(C3,B4)-50,SUM(C3,B4)))
    Paste the following into cell D4: =IF(B4="","",SUM(B$4:B4)-C4)
    Select C4:D4 and then drag the fill handle down to cell D26
    Paste the following into cell G5: =INDEX(C:C,SUMPRODUCT(--(C:C<>""))+3,1)
    Paste the following into cell F12: =INDEX(D:D,SUMPRODUCT(--(D:D<>""))+3,1)/50
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  6. #6
    Registered User
    Join Date
    11-12-2019
    Location
    Ottawa
    MS-Off Ver
    2016
    Posts
    9

    Re: running countif a cell reaches a certain total

    Thanks! worked perfectly!

  7. #7
    Registered User
    Join Date
    11-12-2019
    Location
    Ottawa
    MS-Off Ver
    2016
    Posts
    9

    Re: running countif a cell reaches a certain total

    Sorry, Ive just noticed your formula is not taking into account the rolling 30 days and also including all variances instead of only variances under $50

    I was using the following formula in G5 to accomplish this =SUMIFS(Variance:Variance,date:date,">="&TODAY()-30,date:date,"<="&TODAY(),Variance:Variance, "<=49")
    Im just not sure how to combine them to make it all work.

    Any help is appreciated!

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,563

    Re: running countif a cell reaches a certain total

    Please upload a sample that demonstrates where the method doesn't work.
    Please include the values that you expect so that we will have something against which to compare the output of our formulas/code.
    Let us know if you have any questions.

  9. #9
    Registered User
    Join Date
    11-12-2019
    Location
    Ottawa
    MS-Off Ver
    2016
    Posts
    9

    Re: running countif a cell reaches a certain total

    In the sample provided I would not want the first 2 entries(B4 and B5) to be part of the equation because they are more than 30 days old. I would also not want the B9 entry included in the rolling variance because it is over $50 and is a part of a separate level/calculation (F13). As of Oct 20 (B6) I would expect the rolling balance to only be $40 and then Nov 1(B7) it would hit $60, triggering the reset back down to $10. I included the way I used to do it in the sample(F25) Thanks so much
    Attached Files Attached Files

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,563

    Re: running countif a cell reaches a certain total

    See if this is correct:
    1. Column C is populated using: =IF(B4="","",SUMIFS(B$4:B4,A$4:A4,">="&A4-30,B$4:B4,"<50"))
    2. Column D is populated using: =IF(B4="","",IF(C4>50,C4-50*INT(C4/50),C4))
    3. Column E is populated using: =IF(B4="","",C4-D4)
    4. Rolling Balance formula is: =INDEX(D4:D36,SUMPRODUCT(--(D4:D36<>"")))
    5. Rolling Number of Occurrence is: =MAX(E:E)/50
    Let us know if you have any questions.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-12-2019
    Location
    Ottawa
    MS-Off Ver
    2016
    Posts
    9

    Re: running countif a cell reaches a certain total

    Bang On! Appreciate all the help!

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,563

    Re: running countif a cell reaches a certain total

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

+ 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 after payments running total on excel
    By tmagplayr in forum Excel General
    Replies: 7
    Last Post: 09-26-2017, 02:01 PM
  2. Replies: 8
    Last Post: 07-19-2017, 12:06 PM
  3. Running total in one cell
    By dsdonroad in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-31-2016, 09:35 AM
  4. When sum reaches defined total continue sum in new cell
    By jesska in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-12-2015, 06:42 PM
  5. running total cell macro
    By kpfeif in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-22-2014, 10:30 AM
  6. Find row number of column when it reaches 80% of total
    By bryanbak3 in forum Excel General
    Replies: 6
    Last Post: 01-10-2012, 05:18 PM
  7. How to set up running total in cell?
    By emspilot in forum Excel General
    Replies: 1
    Last Post: 09-01-2010, 03:54 AM

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