vba代码很简单,如下;数据来源于“国务院办公厅关于2020年部分节假日安排的通知”
=workDay(YEAR(TODAY())&"-"&MONTH(TODAY())&"-"&B3)
'判断指定日期是否上班
Function workDay(rq)
Dim cel As Range
If Weekday(rq) = 1 Or Weekday(rq) = 7 Then
temp = "休"
For Each cel In Range("节假日表!B2:B17")
a = DateDiff("d", cel.Value, rq)
If a = 0 Then
temp = "○"
Exit For
End If
Next
Else
temp = "○"
For Each cel In Range("节假日表!A2:A37")
a = DateDiff("d", cel.Value, rq)
If a = 0 Then
temp = "休"
Exit For
End If
Next
End If
workDay = temp
End Function
1