Note that if you have a date column it's actually easier to check whether the date is a weekday or not rather than checking the text day column, i.e. if date is in column G try
=SUMPRODUCT(--(January!$D$1:$D$1000=$A18),--(WEEKDAY(January!$G$1:$G$1000,2)<6), (January!$H$1:$H$1000>="17:00"+0)+(January!$H$1:$H$1000<="04:00"+0),January!$S$1:$S$1000)
...although note that if row 1 has text headers then WEEKDAY function applied to G1 will give an error and cause the formula to fail so you might want to adjust all ranges to start at row 2 in that case.....
Bookmarks