+ Reply to Thread
Results 1 to 21 of 21

Counting consecutive days worked

  1. #1
    Registered User
    Join Date
    09-16-2018
    Location
    Lake Charles, Louisianna
    MS-Off Ver
    2016
    Posts
    9

    Counting consecutive days worked

    I would appreciate greatly help with a formula to count consecutive days worked by an employee(no more than 13 consecutive days), BUT it also needs to reset count when employee misses a day. If possible, having formula dynamic and perform count from current date(which changes daily).. would be great.

    In attached sample, cells with start time are days worked, blank cells represent days not worked.

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Help w/formula : Counting consecutive days worked....

    formula is too long to be translated to English
    Attached Files Attached Files
    Last edited by tim201110; 09-17-2018 at 08:47 AM.

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Help w/formula : Counting consecutive days worked....

    Assuming results in Column AE, and I have interpreted the requirement correctly... below Array formula should present lesser of 13 days and longest sequence.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Note: formula array entry - if applied correctly formula will appear encased within { } [these cannot be added manually]

  4. #4
    Registered User
    Join Date
    09-16-2018
    Location
    Lake Charles, Louisianna
    MS-Off Ver
    2016
    Posts
    9

    Re: Help w/formula : Counting consecutive days worked....

    Quote Originally Posted by tim201110 View Post
    formula is too long to be translated to English
    Thank you for your help. Having trouble copying and pasting formula. When I remove "protected mode" so I can copy formula, gives below error:
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-16-2018
    Location
    Lake Charles, Louisianna
    MS-Off Ver
    2016
    Posts
    9

    Re: Help w/formula : Counting consecutive days worked....

    XLent,

    Thanks for your help.... if possible, results should be in "Days Worked" column. Correct me if I'm wrong.. w/out formula considering current date, I would have to delete column D daily in order to keep the 13 day count accurate. It would be awesome if formula would count days based on current date. I don't know if that's possible. Thanks again..
    Last edited by jeffreybrown; 09-18-2018 at 10:30 AM. Reason: Removed full quote!

  6. #6
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Help w/formula : Counting consecutive days worked....

    Without wanting in interfere, as I suspect tim201110 has your solution, can you clarify the exact requirement.... more specifically, are you looking for most consecutive days worked from today, backwards, up to a maximum of 13 days, or longest working streak in the last 13 days? e.g. an employee works 10 days, has 1 day off, then works both yesterday & today - the answer is a) 2 ... most consecutive days worked backwards from today, or b) 10 -- the most consecutive days worked in the past 13 days ? Clearly a) makes most sense but best to never assume...

  7. #7
    Registered User
    Join Date
    09-16-2018
    Location
    Lake Charles, Louisianna
    MS-Off Ver
    2016
    Posts
    9

    Re: Help w/formula : Counting consecutive days worked....

    XLent,

    An employee cant work more than 13 consecutive days, must have that 14th day off. This count resets when a day isn't worked, whether the 14th or any day prior.
    Last edited by jeffreybrown; 09-18-2018 at 10:30 AM. Reason: Removed full quote!

  8. #8
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Help w/formula : Counting consecutive days worked....

    shorter formula with helper column
    it works for row3 and down
    row1 is new
    and formula calculates the whole month

    =IFERROR(MAX(FREQUENCY(IF(ISNUMBER(INDEX($E3:$AI3,$C3):INDEX(INDEX($E3:$AI3,$C3):$AI3,$C$1)),COLUMN(INDEX($E3:$AI3,$C3):INDEX(INDEX($E3:$AI3,$C3):$AI3,$C$1))),ISBLANK(INDEX($E3:$AI3,$C3):INDEX(INDEX($E3:$AI3,$C3):$AI3,$C$1))*COLUMN(INDEX($E3:$AI3,$C3):INDEX(INDEX($E3:$AI3,$C3):$AI3,$C$1)))),) CSE
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    09-16-2018
    Location
    Lake Charles, Louisianna
    MS-Off Ver
    2016
    Posts
    9

    Re: Help w/formula : Counting consecutive days worked....

    tim201110,

    tim.... on the work sheet, column C shows 17 and column D shows 0. I don't see the count of days worked...? columns E-H(no days worked) I-S(show start times/days worked) blanks are days not worked.
    Last edited by jeffreybrown; 09-18-2018 at 10:31 AM. Reason: Removed full quote!

  10. #10
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Help w/formula : Counting consecutive days worked....

    In case it helps, and if I've understood requirements, below would look for most days worked back from today

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Please note that reference above to $A$24 is a cell containing the following -- and is used to negate need for duplication of calc {the same could be stored in a Named Range etc}

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Note: to test I had to extrapolate your sample data such that there was activity on today's date... it's also unclear what you would want to do if the answer exceeded 13 {I believe you said this could not happen and have thus ignored it, per se}

    if neither solutions are doing what you want it might make sense to post a further sample, alongside expected results in each case.
    Last edited by XLent; 09-18-2018 at 03:26 AM.

  11. #11
    Registered User
    Join Date
    09-16-2018
    Location
    Lake Charles, Louisianna
    MS-Off Ver
    2016
    Posts
    9

    Re: Help w/formula : Counting consecutive days worked....

    XLent,

    I'm sorry... I thought it was clearly stated. My bad. An employee cant work more than 13 consecutive days, if so... he must take off 14th day. Any day off(whether scheduled or missed)restarts the 13 consecutive day count. If the cell in Days Worked is greater than 13, it will be ok. We just have to make sure the person gets a day off asap. Does this clear up the "ignored" expectation?
    Last edited by jeffreybrown; 09-18-2018 at 10:31 AM. Reason: Removed full quote!

  12. #12
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Help w/formula : Counting consecutive days worked....

    Probably overcomplicated, but seems to do the job.
    It's array formula (Ctrl+Shift+Enter committed):
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See attached

    PS. If opened tomorrow will show only 0's as tomorrow column is empty
    Attached Files Attached Files
    Best Regards,

    Kaper

  13. #13
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Help w/formula : Counting consecutive days worked....

    Hi Kaper, that would generate same results as my suggestion albeit yours caters for possibility of there being no "break" which mine did not -- oops.

    Adapted the below per above - I think this would be a little more efficient but tbh given they're both volatile (c/o TODAY) there's unlikely to be any notable difference {given sample size}.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    On an aside I think the results for the non-gaps should read 21 rather than 20? i.e. $D$1-1

  14. #14
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613
    I think you are right with 21.
    -1 shall be inserted in iferror formula as you suggested

  15. #15
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Counting consecutive days worked

    csweezy,

    Please don't quote whole posts -- it's just clutter. If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding

    For normal conversational replies, try using the quick reply box below.
    HTH
    Regards, Jeff

  16. #16
    Registered User
    Join Date
    09-16-2018
    Location
    Lake Charles, Louisianna
    MS-Off Ver
    2016
    Posts
    9

    Re: Counting consecutive days worked

    Will do. Thanks.

  17. #17
    Registered User
    Join Date
    09-16-2018
    Location
    Lake Charles, Louisianna
    MS-Off Ver
    2016
    Posts
    9

    Re: Counting consecutive days worked

    I input formula, and cant get it functioning. Used contrl+shift+enter, Excel accepts formula, but doesn't work. Also, cell A24 is used for employee information. I have attached full workbook. Red tab "Late-Consecutive Days" contains worksheet sample represented.
    Appreciate any clarifications. Thank you

  18. #18
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Counting consecutive days worked

    No attachment visible

    BTW: have you tried my previous attachment.
    Probably with the the minor correction of -1 suggested few posts below post with attachment?

  19. #19
    Registered User
    Join Date
    05-15-2019
    Location
    Melbourne
    MS-Off Ver
    2016
    Posts
    1

    Re: Help w/formula : Counting consecutive days worked....

    Great help

  20. #20
    Forum Contributor
    Join Date
    02-20-2011
    Location
    Candada
    MS-Off Ver
    Microsoft Office 365
    Posts
    174

    Re: Help w/formula : Counting consecutive days worked....

    Hello Kaper,
    I'm looking at the Zeszyt2 file and your formula 492 work days. I'm not sure if your formula is working properly. However, I have facing with the same issue as csweezy and I need your excellent help, and I would appreciate your assistant.

  21. #21
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Counting consecutive days worked

    So check first if it is working as expected. If yes - just use it ( if the above answers were helpful, you may add me reputation by clicking a star in lower left corner of my post(s)).
    If not - follow rule 4 of our https://www.excelforum.com/forum-rul...rum-rules.html and start a new thread. It will be a good idea to give a link to this thread in a new one, and of course to attach sample workbook.
    Last edited by Kaper; 01-04-2020 at 12:44 AM.

+ 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] Counting days worked
    By kbiro in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-25-2016, 05:45 PM
  2. [SOLVED] Formatting of consecutive days worked
    By ktbb0312 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-23-2015, 05:46 PM
  3. Replies: 2
    Last Post: 11-05-2011, 07:29 AM
  4. Replies: 9
    Last Post: 09-03-2007, 08:26 PM
  5. Counting the days worked in a month by employee
    By Curtis in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-08-2005, 01:20 PM
  6. Counting te days worked in a month
    By Curtis in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-07-2005, 01:10 PM
  7. [SOLVED] Counting days worked
    By anonymous person in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-22-2005, 04:06 PM

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