任意日期想知道是周几用weeknum意思就是第几周的意思
我们查日历可以知道2023/1/1是周日,通过=WEEKDAY(A2,2)模式为2也就是一周的起始日期为周一,返回的值是7
日期 | weekday返回是周几 | weeknub第几周 |
2023/1/1 | 7 | 1 |
2023/1/2 | 1 | 2 |
2023/1/3 | 2 | 2 |
2023/1/4 | 3 | 2 |
2023/1/5 | 4 | 2 |
2023/1/6 | 5 | 2 |
2023/1/7 | 6 | 2 |
2023/1/8 | 7 | 2 |
2023/1/9 | 1 | 3 |
2023/1/10 | 2 | 3 |
2023/1/11 | 3 | 3 |
2023/1/12 | 4 | 3 |
2023/1/13 | 5 | 3 |
2023/1/14 | 6 | 3 |
2023/1/15 | 7 | 3 |
=WEEKNUM(A2,2)
第二个参数代表你选择的一周起始日期是哪一天,选择2意味着开始日期是周一,默认的开始日期是周日
日期 | weekday返回是周几 | weeknub第几周返回值 | weeknub函数 |
2023/1/1 | 7 | 1 | =WEEKNUM(A2,2) |
2023/1/2 | 1 | 2 | =WEEKNUM(A3,2) |
2023/1/3 | 2 | 2 | =WEEKNUM(A4,2) |
2023/1/4 | 3 | 2 | =WEEKNUM(A5,2) |
2023/1/5 | 4 | 2 | =WEEKNUM(A6,2) |
2023/1/6 | 5 | 2 | =WEEKNUM(A7,2) |
2023/1/7 | 6 | 2 | =WEEKNUM(A8,2) |
2023/1/8 | 7 | 2 | =WEEKNUM(A9,2) |
2023/1/9 | 1 | 3 | =WEEKNUM(A10,2) |
2023/1/10 | 2 | 3 | =WEEKNUM(A11,2) |
2023/1/11 | 3 | 3 | =WEEKNUM(A12,2) |
2023/1/12 | 4 | 3 | =WEEKNUM(A13,2) |
2023/1/13 | 5 | 3 | =WEEKNUM(A14,2) |
2023/1/14 | 6 | 3 | =WEEKNUM(A15,2) |
2023/1/15 | 7 | 3 | =WEEKNUM(A16,2) |
我们可以验证出来weeknub返回的第几个周是正确的,然后可以任意日期去通过weeknub返回是一年的第几个周
评论 (0)