1.新建一张表格,如图所示,在表中输入日期、本年度第几周、本月第几周,然后再日期列中输入一些日期,格式为2013-2-20.
2.单击工具——加载宏,打开对话框,在“分析工具库”前打上勾,单击确定。
3.选定B2单元格,在B2单元格中输入函数=WEEKNUM(A2,2),在单元格中就出现了本年度周次,用填充手柄把下面的单元格也填充满。
4.选定C2单元格,在C2单元格中输入函数=WEEKNUM(A2,2),在单元格中就出现了本周周次,用填充手柄把下面的单元格也填充满。现在表格就制作好了。
1、按照每月计算周
=YEAR(A1) & "年" & MONTH(A1) & "月" & "第" & INT(DAY(A1)/7+1) & "周"
2、按照日历计算周
=IF(AND(WEEKDAY(DATE(YEAR(A1),1,1),2) > 1,FLOOR(DATEDIF(DATE(YEAR(A1),1,1),A1+WEEKDAY(DATE(YEAR(A1),1,1)-8,2),"D")/7,1)=0), FLOOR(DATEDIF(DATE(YEAR(A1)-1,1,1),DATE(YEAR(A1),1,1)+WEEKDAY(DATE(YEAR(A1)-1,1,1)-8,2),"D")/7,1), FLOOR(DATEDIF(DATE(YEAR(A1),1,1),A1+WEEKDAY(DATE(YEAR(A1),1,1)-8,2),"D")/7,1))
3、按照日历计算周(区别上年最后一周(0),本年最后一周(52))
=ROUNDUP((A1-DATE(YEAR(A1),1,)+MOD(WEEKDAY(DATE(YEAR(A1),1,),2),7))/7,0)-1
假设2007-1-25放在A1单元格,在B1单元格输入下列公式:
=YEAR(A1) & "年" & MONTH(A1) & "月" & "第" & INT(DAY(A1)/7+1) & "周"
然后复制公式.
如果以星期日为一个星期的第1天,公式可以这样:
=YEAR(A1)&"年"&MONTH(A1)&"月第"&IF(DAY(A1)<=7-WEEKDAY(DATE(YEAR(A1),1,1),2),1,ROUNDUP((DATEDIF(DATE(YEAR(A1),1,1),A1+1,"yd")-(7-WEEKDAY(DATE(YEAR(A1),1,1),2)))/7,0)+1)&"周"