Closed Thread
Results 1 to 11 of 11

Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

  1. #1
    Registered User
    Join Date
    01-16-2014
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    3

    Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

    I have been attempting to wrap my head around this for a week now to no avail. I've attempted searching, but either couldn't find a similar problem or couldn't describe my situation accurately enough to find anything useful. Hopefully someone can help!

    In my spreadsheet, H2:BF2 contains the date of every Monday formatted as 01/13/2014. I am looking to count the number of consecutive blank cells in row 3 that is within a range between 01/13/2013 and the last Monday that just passed closest to TODAY().

    Row 3 is going to contain a simple X. I am tracking how often a user attends a certain class. This class takes place every Monday from now until year end. Each time someone attends, that column for the date the session is held will be marked with an X. I am trying to write a formula which will count the number of consecutive blank cells in a range from 1/13/2013 only through the last class held. E.g., if today were Tuesday March 4th, I would want the formula to only go from H3:O3 (since cell O2 has a value of "3/3/2014").

    The ultimate goal is to be notified if someone missed 3 classes in a row. However, if I just count consecutive blank cells like in the following formula:
    Please Login or Register  to view this content.
    Then it gives me 51, since it is counting all the way through the end of the year. Is there anyway to create a formula accomplishing the same goal, but checking H2:BF2, picking the closest date that has already passed, then ending the count there?

    I have attached a sample workbook to clarify
    Sample-Workbook.xlsx

  2. #2
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

    Welcome to the forum!

    This is a challenging and interesting task...

    In column F you are trying to get the count of consecutive 3 blank cells which can be computed via following formula (your CF formula will have to be changed from 3 to 1 because each of 3 consecutive blank cells will be counted as 1):
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In case you would like to know which class # is the first time that someone missed 3 consecutive classes, try this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Or which class # is the last time that someone missed 3 consecutive classes, try this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.





    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin
    Last edited by alvin-chung; 01-16-2014 at 08:17 PM.

  3. #3
    Registered User
    Join Date
    01-16-2014
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

    Thank you very much for your reply! I appreciate you taking a look at the problem I'm having. Unfortunately, that first formula does not seem to work perfectly. I moved the dates back that started in H1 to be able to test the formula out. As you can see from this screenshot below, there are three consecutive blank cells, but it only counts 1:

    PREVIEW.png

    The formula does work at not counting past Today's date, which is helpful. Any ideas why it seems to be only counting 1?

    Thank you.
    Last edited by tophatpete; 01-17-2014 at 10:07 AM.

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

    Hi,

    Are you able to re-upload your attachment with various examples on different rows and your desired results outlined in each case? It's much easier to create formulas if you have a clear picture of what the end result should be.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  5. #5
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

    Quote Originally Posted by tophatpete View Post
    Thank you very much for your reply! I appreciate you taking a look at the problem I'm having. Unfortunately, that first formula does not seem to work perfectly. I moved the dates back that started in H1 to be able to test the formula out. As you can see from this screenshot below, there are three consecutive blank cells, but it only counts 1:

    Attachment 290748

    The formula does work at not counting past Today's date, which is helpful. Any ideas why it seems to be only counting 1?

    Thank you.
    It seems correct to me, try refer back to post #2 which I mentioned this for the first formula
    "In column F you are trying to get the count of consecutive 3 blank cells which can be computed via following formula (your CF formula will have to be changed from 3 to 1 because each of 3 consecutive blank cells will be counted as 1)"

    Thus if you have consecutive 4 blank cells, that means some one had missed 2 times because there were 2 occurrences of 3 consecutive blank cells.



    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin

  6. #6
    Registered User
    Join Date
    01-16-2014
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

    Hi,

    No problem. I have re-uploaded the sample worksheet. In the sample, Column F is currently reading what I would like it to once the formula is created. In Row 2, the student has missed 3 consecutive classes. In row 3, although the student has missed 3 classes total, I'd like it to only read 1 since he/she never missed more than 1 class at a time. Row 4 should read 2 since the student missed a maximum of 2 consecutive classes (even though they missed a total of 4 classes).

    Hopefully this clears up the confusion a little bit!

    Sample-Workbook.xlsx

  7. #7
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

    Hmm... what if he/she attended/missed classes like x;-;x;-;-;x;x;x;-;-;x would you expect a return of 1 or 2 for such cases?

    ps: due to various possibility of attend/miss a class, that's why I propose a solution where it will count 1 whenever 3 consecutive blanks were found (which meets your ultimate goal)

    ps: you might also want to try out other formulas in post #2 that will tell you which first/last class that the student missed out 3 times consecutively



    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

    Hmmm...

    I downloaded your file but for whatever reason I can't scroll the sheet to the right to see your data.

    Other files scroll as expected in all the versions of Excel I have installed.

    Scroll lock does not fix the problem.

    I'm stumped!
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  9. #9
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

    I'm not sure if I'm not missing something here, but it seems as though you already had the formula, save for the adjustment you outlined, in your very first post.

    If you go to Name Manager and define a new name, Attendance_Range, say, and enter this in the Refers to: box:

    ='Class Roster'!$H2:INDEX('Class Roster'!$H2:$BF2,MATCH(TODAY(),'Class Roster'!$H$1:$BF$1))

    Your (array) formula in F2 then becomes:

    =MAX(FREQUENCY(IF(ISBLANK(Attendance_Range),COLUMN(Attendance_Range)),IF(ISTEXT(Attendance_Range),COLUMN(Attendance_Range))))

    which can then be copied down to successive cells in that column (the Named Range as defined is relative with respect to rows).

    Regards

  10. #10
    Registered User
    Join Date
    11-28-2020
    Location
    Oman
    MS-Off Ver
    2013
    Posts
    1

    Re: Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

    HI there

    i need help to count the consecutive 3 empty cells

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,688

    Re: Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 09-12-2013, 11:32 PM
  2. Replies: 2
    Last Post: 07-25-2013, 01:01 PM
  3. Replies: 1
    Last Post: 09-17-2012, 01:07 AM
  4. Replies: 4
    Last Post: 01-15-2012, 12:42 PM
  5. Replies: 2
    Last Post: 09-01-2010, 07:48 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