利用EXCEL设计考勤统计公式

2024-12-16 03:24:54
推荐回答(1个)
回答1:

单元格B2输入公式
=IF(COUNTIF(G2:M2,MIN(G2:M2,"11:00:00"))<1,DAY(F2)&"号缺上午上班考勤","")&IF(COUNTIF(G2:M2,MAX(G2:M2,"12:00:00"))<1,DAY(F2)&"号缺下午上班考勤","")

单元格A2输入数组公式(输入公式后,同时按下Ctrl+Shift+Enter)
=IF(COUNTIF(G2:M2,"<=7:03:00")>0,0,MIN(IF(G2:M2-"7:03:00">0,G2:M2,""))-"7:00:00")+IF(COUNTIFS(G2:M2,">11:00:00",G2:M2,"<=13:03:00")>0,0,MIN(IF(G2:M2-"13:03:00">0,G2:M2,""))-"13:00:00")

注意:这个得到的迟到时间(上午迟到时间+下午迟到时间),缺少考勤时(旷工)会把
旷工时间也加在里面。

如果旷工不算在迟到时间里面,可以改用下面的数组公式
=IF(OR(COUNTIF(G2:M2,"<=7:03:00")>0,MIN(G2:M2)-"11:00:00">0),0,MIN(IF(G2:M2-"7:03:00">0,G2:M2,""))-"7:00:00")+IF(OR(COUNTIFS(G2:M2,">11:00:00",G2:M2,"<=13:03:00")>0,MAX(G2:M2)-"12:00:00"<0),0,MIN(IF(G2:M2-"13:03:00">0,G2:M2,""))-"13:00:00")
(输入公式后,同时按下Ctrl+Shift+Enter)