Perhaps this will help.
On the LeaveCal2 sheet the 'From' date is placed in cell G2 and the 'To' date is placed in cell I2
Cells C6 and to the right are populated using: =IF(B6< $I2,SUM(B6,1),"")
Cells B5 and to the right are populated using: =IF(B6="","",B6)
A column is added on the Datatable sheet, to identify those names that need to be listed on the LeaveCal2 sheet, which is populated using:
Formula:
=COUNTIFS(A$2:A2,A2,C$2:C2,">="&LeaveCal2!G$2,C$2:C2,"<="&LeaveCal2!I$2,B$2:B2,LeaveCal2!B$1)
The names on the LeaveCal2 sheet are populated using:
Formula:
=IFERROR(INDEX(tblData[Employee],AGGREGATE(15,6,(ROW(tblData[Employee])-ROW(tblData[#Headers]))/(tblData[Include Name]=1),ROWS(A$1:A1))),"")
Let us know if you have any questions.
Bookmarks