+ Reply to Thread
Results 1 to 5 of 5

Counting Maximum Consecutive Days

Hybrid View

  1. #1
    Registered User
    Join Date
    08-26-2013
    Location
    Alberta
    MS-Off Ver
    Excel 2003
    Posts
    5

    Counting Maximum Consecutive Days

    I have a very large spreadsheet of dates and hours worked. I am trying to count the maximum number of consecutive days worked regardless of the hours worked in the day. The dates and hours are in a row rather than a column as exampled below.
    Here is an example:

    17 Feb 2013 8
    18 Feb 2013 8
    19 Feb 2013 10
    20 Feb 2013
    21 Feb 2013 11
    22 Feb 2013 8
    23 Feb 2013 9
    24 Feb 2013 10
    25 Feb 2013 7
    26 Feb 2013 9
    27 Feb 2013
    28 Feb 2013
    01 Mar 2013 8
    02 Mar 2013 8
    03 Mar 2013 9


    = 6 consecutive days

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Counting Maximum Consecutive Days

    Assuming the dates are always sequential,
           ----A---- --B-- C D -------------------------------------E-------------------------------------
       1     Date    Hours                                                                                
       2   17-Feb-13     8   6 D2: {=MAX(FREQUENCY(IF(B2:B16>0, ROW(B2:B16)), IF(B2:B16=0, ROW(B2:B16))))}
       3   18-Feb-13     8                                                                                
       4   19-Feb-13    10                                                                                
       5   20-Feb-13                                                                                      
       6   21-Feb-13    11                                                                                
       7   22-Feb-13     8                                                                                
       8   23-Feb-13     9                                                                                
       9   24-Feb-13    10                                                                                
      10   25-Feb-13     7                                                                                
      11   26-Feb-13     9                                                                                
      12   27-Feb-13                                                                                      
      13   28-Feb-13                                                                                      
      14   01-Mar-13     8                                                                                
      15   02-Mar-13     8                                                                                
      16   03-Mar-13     9
    The curly braces indicate that the formula MUST be confirmed with Ctrl+Shift+Enter -- that's what makes them appear in the formula bar.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    08-26-2013
    Location
    Alberta
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Counting Maximum Consecutive Days

    Unfortunately it didn't work.
    I changed the formula to: {=MAX(FREQUENCY(IF(D9:GB9>0, ROW(D9:GB9)), IF(D9:GB9=0, ROW(D9:GB9))))} with the ctrl shift enter
    It game me a answer of 152 and should have been 34 (in the line example I tested)
    All of the non-work days are blank - would that have caused the error?
    See attached.
    Attached Files Attached Files
    Last edited by Delleeb; 08-26-2013 at 03:21 PM. Reason: Attached example.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Counting Maximum Consecutive Days

    If the data is disposed in rows, change ROW to COLUMN.

    EDIT:
          ----GC---- --GD--- ----------------------------------------GE----------------------------------------
      1   Max Consec Formula                                                                                   
      2        34.00   34.00 GD2: {=MAX(FREQUENCY(IF(E2:GC2>0, COLUMN(E2:GC2)), IF(E2:GC2=0, COLUMN(E2:GC2))))}
      3        27.00   27.00
    Last edited by shg; 08-26-2013 at 03:47 PM.

  5. #5
    Registered User
    Join Date
    08-26-2013
    Location
    Alberta
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Counting Maximum Consecutive Days

    You Rock!! It works - thanks!

+ 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. Employee Time Tracking - Sick days & Consecutive Days
    By notaguru6 in forum Excel General
    Replies: 6
    Last Post: 08-09-2013, 12:50 PM
  2. Counting the maximum consecutive cells by font color
    By moppyau in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-06-2013, 10:01 PM
  3. [SOLVED] count the maximum number consecutive
    By Berna11 in forum Excel General
    Replies: 9
    Last Post: 07-13-2012, 11:27 AM
  4. Maximum Consecutive Drawndown formula
    By asaini009 in forum Excel General
    Replies: 6
    Last Post: 02-06-2012, 05:24 PM
  5. Calculating value for maximum consecutive value
    By than_k22 in forum Excel General
    Replies: 7
    Last Post: 10-15-2010, 01:08 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