voitoosh,
Attached is an example workbook based on the criteria you described.
Cell B1 contains a drop-down list where you can pick the month
Cell B2 contains a drop-down list where you can pick the year
The sheet containing those lists is on sheet 'Lists' and they are named ranges listMonths and listYears.
Cell B3 uses a formula to calculate the number of days for the selected Month and Year:
Then in row 5 are headers.
Column A contains names and Column B contains their employee ID's (these are made up in my example)
In cell C5 and copied right is this formula to show the day number (and it will only go to the number of days for the selected month):
In cell AI6 and copied down is this formula to get the number of consecutive blanks greater than 5:
In cell AI7 and copied down is this formula to get the number of cells for each block of consecutive blanks greater than 5:
Those formulas utilize a UDF (User Defined Function) that I created named CountConsecutiveBlanks which is defined with this code:
The formula accepts three arguments:
rRange: This is the range of cells that the formula will check for blanks
lThreshold: This is the threshold of consecutive blanks that must be exceeded in order to be counted. Because you need this to count greater than 5, I have set it to 5 in the formulas shown above.
[bCountOverThreshold]: This is an optional boolean (true/false) value. By default it is set to true. When true, it will count the number of blocks of consecutive blanks that are greater than the threshold. When false, it will give a count of the number of cells for each block of consecutive blanks greater than the threshold.
Note that I have used the Freeze Panes feature to keep the Month/Year and Names visible, as well as the Day #'s, so that you can scroll right and down and still be aware of which employee for what day you're looking at. You will also have to enable macros for the UDF to work properly, otherwise it will display a #NAME? error.
Does that work for you?
Bookmarks