提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何在Excel中将星期数转换为日期,反之亦然?

有没有办法从给定的日期获取星期编号或从Excel中的特定星期编号和年份提取日期范围? 为了解决这个问题,下面的公式可能对你有帮助。

使用公式将星期编号转换为日期

使用公式将日期转换为星期数

在Excel中单击即可将多个非标准格式日期/数字/文本转换为正常日期

Kutools为Excel的 转换为日期 实用程序可以帮助您轻松识别并将非标准日期或数字(yyyymmdd)或文本转换为正常日期,只需在Excel中单击即可。 全功能免费试用30天!
广告转换为日期1

Office选项卡在Office中启用选项卡式编辑和浏览,使您的工作更轻松......
Kutools for Excel解决了您的大多数问题,并使您的生产率提高了80%
  • 重用任何东西: 将最常用或最复杂的公式,图表和其他任何内容添加到您的收藏夹中,并在将来快速重复使用它们。
  • 超过20文本功能: 从文本字符串中提取数字; 提取或删除部分文本; 将数字和货币转换为英语单词...
  • 合并工具:多个工作簿和表格合二为一; 合并多个单元格/行/列而不丢失数据; 合并重复行和总和...
  • 拆分工具:根据价值将数据拆分为多个表格; 一个工作簿到多个Excel,PDF或CSV文件; 一列到多列......
  • 粘贴跳过 隐藏/过滤行; 数和总和 按背景颜色; 创建邮件列表和 通过Cell的价值发送电子邮件...
  • 超级过滤器: 创建高级过滤方案并应用于任何工作表; 排序 按周,日,频率等; 筛选 通过大胆,公式,评论......
  • 超过300强大的功能; 与Office 2007-2019和365一起使用; 支持所有语言; 在您的企业或组织中轻松部署。

箭头蓝色右泡 使用公式将星期编号转换为日期

假设我在工作表中有一个随机的年份和星期编号,如下面的屏幕截图所示,现在我想根据给定的周数找出周一到周日的具体日期。

要按特定周数计算日期范围,可以使用以下公式:

1。 选择一个空白单元格,你将返回开始日期(在我们的例子中,我们选择单元格B5),输入公式: =MAX(DATE(B1,1,1),DATE(B1,1,1)-WEEKDAY(DATE(B1,1,1),2)+(B2-1)*7+1),然后按 输入 键。 看下面的截图:

2。 选择另一个空白单元格,您将返回结束日期(在我们的例子中,我们选择单元格B6),请输入 =MIN(DATE(B1+1,1,0),DATE(B1,1,1)-WEEKDAY(DATE(B1,1,1),2)+B2*7),然后按 输入 键。 看下面的截图:

注意丝带 公式太难记了? 将公式保存为自动文本条目,以便将来只需点击一下即可重复使用!
阅读全文... 免费试用

注意:在上述两个公式中, B1 包含一年和 B2 是指定的周数,您可以根据需要更改参数)。

3。 如您所见,这两个公式都会返回数字而不是日期。 继续选择两个计算结果,然后单击 主页 > 数字格式 框> 短日期 将数字更改为日期。 看下面的截图:


箭头蓝色右泡 使用公式将日期转换为星期数

另一方面,您也可以应用WEEKNUM功能将日期转换为相应的星期编号。

1。 选择一个空白单元格,您将返回星期编号,输入此公式: = WEEKNUM(B1,1),然后按Enter键。 看截图:

备注:

(1)在上式中, B1 包含您想要使用的日期。

(2) 如果您需要从星期一开始的日期返回周数,请使用以下公式: = WEEKNUM(B1,2).


箭头蓝色右泡相关文章:

如何统计Excel中两个日期之间的特定工作日数量?

如何在Excel中添加/减去日期/月/年?


Kutools for Excel解决了您的大多数问题,并使您的生产率提高了80%

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能30天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Biswajit · 2 months ago
    Hi please help me.

    Suppose we are considering Date 1 to 7 is week 1 and 8 to 14 is week 2. Can you please help me out how can i use if function to calculate week. I have tried but not able to get the correct result.
  • To post as a guest, your comment is unpublished.
    jtaylorg91 · 6 months ago
    Thank YOU!!!!
  • To post as a guest, your comment is unpublished.
    geoffsmile · 2 years ago
    Thank you very much!


    =CONCATENATE("Inclusive Dates: ",TEXT(MAX(DATE(TEXT(TODAY(),"yyyy"),1,1),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+(WEEKNUM(TODAY())-1)*7+1),"MMMM")," ",TEXT(MAX(DATE(TEXT(TODAY(),"yyyy"),1,1),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+(WEEKNUM(TODAY())-1)*7+1),"DD"),", ",TEXT(MAX(DATE(TEXT(TODAY(),"yyyy"),1,1),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+(WEEKNUM(TODAY())-1)*7+1),"YYYY")," - ",TEXT(MIN(DATE(TEXT(TODAY(),"yyyy")+1,1,0),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+WEEKNUM(TODAY())*7),"MMMM")," ",TEXT(MIN(DATE(TEXT(TODAY(),"yyyy")+1,1,0),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+WEEKNUM(TODAY())*7),"DD"),", ",TEXT(MIN(DATE(TEXT(TODAY(),"yyyy")+1,1,0),DATE(TEXT(TODAY(),"yyyy"),1,1)-WEEKDAY(DATE(TEXT(TODAY(),"yyyy"),1,1),2)+WEEKNUM(TODAY())*7),"YYYY"))
  • To post as a guest, your comment is unpublished.
    seld · 2 years ago
    Date(2017;1;7 * weeknumer - 5)

    5 monday, 4 tuesday... :)
    • To post as a guest, your comment is unpublished.
      Katy · 1 years ago
      Or to make in not specific to the year 2017...
      =DATE(YEAR,1,7 * WEEKNUM - WEEKDAY(DATE(YEAR,1,7) - 2))

      2 monday, 3 tuesday,...
  • To post as a guest, your comment is unpublished.
    Lynnwood · 2 years ago
    I'm sorry folks, but I could neither understand nor make work any of the formulas above so I finally figured out the following solution:
    DATE(B1,1,1)+($A4×7)−(6−(7−WEEKDAY(DATE(B1,1,1),first-day)))

    The first part "DATE(B1,1,1)+(B2×7)" simply takes January 1 of the year and adds the number of weeks.

    The next part calculates how many days to subtract from the WEEKDAY of January 1 to get the first day of the week. This is what I finally figured out:
    6−(7−WEEKDAY(DATE(B1,1,1),first-day))
    If, for example, January 1 falls on a Sunday (day 7), then this formula become "6-(7-7)" or simply 6 - which is the number of days you need to subtract to get Monday of that week. Try other days.

    Finally, if you want to find any other day of the week, just add the WEEKDAY number minus 1 to this result. So the last day of the week (Sunday) is:
    DATE(B1,1,1)+($A4×7)−(6−(7−WEEKDAY(DATE(B1,1,1),first-day)))+(7−1)
    Which can be simplified to:
    DATE(B1,1,1)+($A4×7)−(12−(7−WEEKDAY(DATE(B1,1,1),first-day)))
    Wednesday would be:
    DATE(B1,1,1)+($A4×7)−(8−(7−WEEKDAY(DATE(B1,1,1),first-day)))
    etc.
    I hope this helps someone else who needs this both with a workable solution along with a bit of understanding of how it was arrived at!
  • To post as a guest, your comment is unpublished.
    TJ · 3 years ago
    It's a great formulas and ideal! However, it's important to point out that Excel default system week number counts from Sunday to Saturday. Adjustment is needed if the week number is extracted from Excel Weeknumber formulas.
  • To post as a guest, your comment is unpublished.
    DavidK · 3 years ago
    I am using UK date format of dd/mm/yyy
    • To post as a guest, your comment is unpublished.
      m · 3 years ago
      that shouldn't be a problem. :)

      you can handle the output 'visual' either by:
      1) encasing the entire formula in a text() function, where the second argument will be your custom date format of dd/mm/yyyy...

      or

      2) which might be easier... ctrl+1, number tab, custom, dd/mm/yyyy

      excel handles dates as whole numbers anyway... so the "output" format is very arbitrary.

      if you decide to use the first option... it'll look like this:

      =text(a1,"dd/mm/yyyy")

      instead of a1 however, use whatever formula you've devised to return the correct date you're looking for.


      Hope that helps!
      ~Cheers,
  • To post as a guest, your comment is unpublished.
    DavidK · 3 years ago
    Hi

    Thanks for this formula.

    The example works for 2015, week 15

    For 2016, week 15 the returned StartDate: 04/04/2016 Enddate:10/04/2016

    I am using Excel 2003.
    • To post as a guest, your comment is unpublished.
      Mollum · 3 years ago
      =MAX(DATE(B1,1,1),DATE(B1,1,1)-WEEKDAY(DATE(B1,1,1),2)+(B2-1)*7+4)

      =MIN(DATE(B1+1,1,0),DATE(B1,1,1)-WEEKDAY(DATE(B1,1,1),2)+B2*7+1)
    • To post as a guest, your comment is unpublished.
      Tigris1987 · 3 years ago
      I agree with DavidK, the formula to convert weeknummers into dates works for 2015 but not for 2016 (as week 1 starts on 4th of January). Is there a formula that works for all years? I am very thankful for the answer to this.
    • To post as a guest, your comment is unpublished.
      Tigris · 3 years ago
      I agree with DavidK that the formula to convert Weeknrs into dates works for 2015, but not for 2016 (as week 1 starts on 4th of January). Is it possible to have a formula that works for all years?
  • To post as a guest, your comment is unpublished.
    Cor · 4 years ago
    Thanks for the formula, i was searching for it.

    I have a Office 2010 Excel client and the formula didn't work directly. I had to change the commas to dot-commas for the formula to work for me. So it's like this:

    =MAX(DATE(G1;1;1);DATE(G1;1;1)-WEEKDAY(DATE(G1;1;1);2)+(F1-1)*7+1)

    ... where G1 is the year and F1 is the weeknumber.

    Hopefully it can help others aswell.

    Greetz,
    Cor