网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

如何EXCEL通过第几周获得日期或者天(星期几)

时间:2024-10-26 00:46:02

1、按“ALT+F11”两个按键,弹出VBA模式右击Thisworkbook-插入-模块

如何EXCEL通过第几周获得日期或者天(星期几)

2、拷贝下面代码到空白处,然后关闭VBAFunction week2Day(y As Integer, i As Integer, k As Integer) As String Dim datetemp As Date, j As Integer If i > 52 Then MsgBox ("一年最多只有52个周!") weekFristDay = "1900-1-1" Exit Function End If datetemp = y & "-" & 1 & "-" & 1 j = VBA.Weekday(datetemp, vbMonday) j = (8 - j) + (i - 2) * 7 datetemp = DateAdd("d", j + k - 1, datetemp) week2Day = CStr(datetemp)End Function

如何EXCEL通过第几周获得日期或者天(星期几)

3、在空单元格中输入下面函数=week2day(2014,1,5) ‘其中第一个参数是年,第二个参数是第几周,第三个参数该周第几天,该函数返回为2014-1-3日

如何EXCEL通过第几周获得日期或者天(星期几)
© 2025 智德知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com