This proposal employs a couple of helper ranges:
In the first range (AH1:BD64):
1. AI2:AI64 is populated using: =IF(Z3<>"",Z3,AI2)
2. AJ2:BD64 is populated using:
Formula:
=IF(NOT(ISNUMBER($AA2)),"",IF(NOT(OR(AND(AJ$1>=$AA2,AJ$1<=$AB2),AND(AJ$1>=$AC2,AJ$1<=$AD2),AND(AJ$1>=$AE2,AJ$1<=$AF2))),$AI2,""))
In the second range (AH66:BD105), AJ66:BD105 is populated using:
Formula:
=IFERROR(INDEX(AJ$3:AJ$63,AGGREGATE(15,6,(ROW(AJ$3:AJ$63)-ROW(AJ$2))/(AJ$3:AJ$63<>"")/($AH$3:$AH$63=$AH66),COUNTIFS($AH$66:$AH66,$AH66))),"")
The Monday drop downs (B62:U64) have the source:
Formula:
=OFFSET($AJ$66,MATCH($A$60,$AH$66:$AH$105,0)-1,MATCH(B$61,$AJ$1:$BD$1,0)-1,SUMPRODUCT(($AJ$66:$BD$105<>"")*($AH$66:$AH$105=$A$60)*($AJ$1:$BD$1=B$61)),1)
Let us know if you have any questions.
Bookmarks