I would give 2 options: one with helper column D and other w/o
Focus is only on the time, regardless of the date format (US or UK).
C3:
=IF(B3="","",IF(OR(A3<>"",B2=""),IF(TRIM(RIGHT(B3,11))+0>TIME(8,5,0),"Late",""),""))
D3:
=IF(C3="","",LOOKUP(2,1/(A$3:A3<>""),A$3:A3))
Then K3 drag down
=COUNTIFS($C$3:$C$106,"Late",$D$3:$D$106,J3)
W/o helper column D:
L4 (or the last Agent in list):
=SUMPRODUCT((ROW($C$3:$C$106)>=MATCH(J4,$A$3:$A$106,0))*($C$3:$C$106="Late"))
Then L3 copy up to top
=SUMPRODUCT((ROW($C$3:$C$106)>=MATCH(J3,$A$3:$A$106,0))*($C$3:$C$106="Late"))-SUM(L4:$L$4)
Bookmarks