简体   繁体   English

在 Excel 中将年份和 ISO 周转换为日期?

[英]Convert year and ISO-week to date in Excel?

The year is A1=2012 The ISO-week is A2=1年份是 A1=2012 ISO-week 是 A2=1

As I understand it the standard way to decide to which month a week belongs is to look at in which month the Thursday occurs.据我了解,决定一周属于哪一个月的标准方法是查看星期四发生在哪一个月。

Thus, I would like to find the date of the Thursday with year A1 and ISO week A2.因此,我想在 A1 年和 ISO 周 A2 中找到星期四的日期。 How can I find the date of the Thursday?如何找到星期四的日期?

I know that this thread is related, but I can't figure this out: calculate the month from the year and week number in excel我知道这个线程是相关的,但我无法弄清楚: 从 excel 中的年和周数计算月份

The Thursday of week 1 will always be the first Thursday of the year, then you obviously add 7 for each week after that, so you can get the Thursday date with this formula第 1 周的星期四将始终是一年中的第一个星期四,然后您显然会在此之后的每周添加 7,因此您可以使用此公式获得星期四的日期

=DATE(A1,1,1+A2*7)-WEEKDAY(DATE(A1,1,3))

with Year in A1 and ISO week number in A2 A1 中的年份和 A2 中的 ISO 周数

To find the date defined by (A1,B1,C1) where A1 = ISO Year, B1 = ISO Week, and C1 = the day of the week, assuming week starts with Monday, day 1, use the following:要查找由 (A1,B1,C1) 定义的日期,其中 A1 = ISO 年,B1 = ISO 周,C1 = 星期几,假设一周从第 1 天星期一开始,请使用以下命令:

In VBA:在 VBA 中:

    S = DateSerial(A1, 1, 3)
    W = Weekday(S)
    D = S - W + 7 * B1 + C1 - 6

Or in one formula in Excel:或者在 Excel 中的一个公式中:

=DATE(A1,1,3) - WEEKDAY(DATE(A1,1,3)) + 7 * B1 + C1 - 6

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM