I guess you might also get away with:
=SUMPRODUCT(--(January!$D$1:$D$1000=$A18),--(LEFT(TEXT(January!$G$1:$G$1000,"ddd"))<>"S"), (January!$H$1:$H$1000>="17:00"+0)+(January!$H$1:$H$1000<="04:00"+0),January!$S$1:$S$1000)
which should account for header - slower though (per the big Bob P)
Bookmarks