Originally Posted by
Ochimus
Vancity,
Thank you for the clarification. Attached formula does what I understand you asked for originally:
=IF(WEEKDAY($A12)=1,SUMPRODUCT(--($F$3:$F$4<=B$11),--($G$3:$G$4>=B$11),--($D$3:$D$4<=$A12),--($E$3:$E$4>=$A12),--($H$3:$H$4="Y"),--ISNUMBER(MATCH($A$3:$A$4,$B$7,0))*--ISNUMBER(MATCH($B$3:$B$4,$B$8,0))*--ISNUMBER(MATCH($C$3:$C$4,$B$9,0)),$O$3:$O$4),IF(WEEKDAY($A12)=2,SUMPRODUCT(--($F$3:$F$4<=B$11),--($G$3:$G$4>=B$11),--($D$3:$D$4<=$A12),--($E$3:$E$4>=$A12),--($I$3:$I$4="Y"),--ISNUMBER(MATCH($A$3:$A$4,$B$7,0))*--ISNUMBER(MATCH($B$3:$B$4,$B$8,0))*--ISNUMBER(MATCH($C$3:$C$4,$B$9,0)),$O$3:$O$4),IF(WEEKDAY($A12)=3,SUMPRODUCT(--($F$3:$F$4<=B$11),--($G$3:$G$4>=B$11),--($D$3:$D$4<=$A12),--($E$3:$E$4>=$A12),--($J$3:$J$4="Y"),--ISNUMBER(MATCH($A$3:$A$4,$B$7,0))*--ISNUMBER(MATCH($B$3:$B$4,$B$8,0))*--ISNUMBER(MATCH($C$3:$C$4,$B$9,0)),$O$3:$O$4),IF(WEEKDAY($A12)=4,SUMPRODUCT(--($F$3:$F$4<=B$11),--($G$3:$G$4>=B$11),--($D$3:$D$4<=$A12),--($E$3:$E$4>=$A12),--($K$3:$K$4="Y"),--ISNUMBER(MATCH($A$3:$A$4,$B$7,0))*--ISNUMBER(MATCH($B$3:$B$4,$B$8,0))*--ISNUMBER(MATCH($C$3:$C$4,$B$9,0)),$O$3:$O$4),IF(WEEKDAY($A12)=5,SUMPRODUCT(--($F$3:$F$4<=B$11),--($G$3:$G$4>=B$11),--($D$3:$D$4<=$A12),--($E$3:$E$4>=$A12),--($L$3:$L$4="Y"),--ISNUMBER(MATCH($A$3:$A$4,$B$7,0))*--ISNUMBER(MATCH($B$3:$B$4,$B$8,0))*--ISNUMBER(MATCH($C$3:$C$4,$B$9,0)),$O$3:$O$4,IF(WEEKDAY($A12)=6,SUMPRODUCT(--($F$3:$F$4<=B$11),--($G$3:$G$4>=B$11),--($D$3:$D$4<=$A12),--($E$3:$E$4>=$A12),--($M$3:$M$4="Y"),--ISNUMBER(MATCH($A$3:$A$4,$B$7,0))*--ISNUMBER(MATCH($B$3:$B$4,$B$8,0))*--ISNUMBER(MATCH($C$3:$C$4,$B$9,0)),$O$3:$O$4,IF(WEEKDAY($A12)=7,SUMPRODUCT(--($F$3:$F$4<=B$11),--($G$3:$G$4>=B$11),--($D$3:$D$4<=$A12),--($E$3:$E$4>=$A12),--($N$3:$N$4="Y"),--ISNUMBER(MATCH($A$3:$A$4,$B$7,0))*--ISNUMBER(MATCH($B$3:$B$4,$B$8,0))*--ISNUMBER(MATCH($C$3:$C$4,$B$9,0)),$O$3:$O$4,""))))))))))
Formula from B12 across and down works as follows:
Check whether (a) the date in A(whatever) is within the Date Span in F - G, (b) there is a "Y" in whichever column in H - N matches the weekday in A(whatever), (c) the time in whichever Hour column you are in is within the Start and Finish times in Cols D and E, and (d) the Criteria in A - C are met. If so, enter the number(s) from Col O.
Key point is that formula works on ANY date where the weekday is that day. If six rows are that day and within the Start and End dates, it posts the relevant volume(s) in each of them automatically.
So in every row where the weekday is a (whatever day), whatever the date, if it is within the time span and there is one Y in row 3, every row from 12 downwards with that weekday will show 100 delegates from the Start to the End times. If you have the Y in row 4 it will show 50 delegates. If both rows have a "Y" it will show 150.
Formula then repeats check for weekdays 2 - 7.
Ochimus
Bookmarks