简体   繁体   中英

excel date from week number and year

I have the following table in Excel that has year number and week number:

Year               Week
-----             ------
2015               33
2014               41
2016               40

How can I get a 3rd column that has the date of the corresponding Friday for each row? So, week 33 of 2015 should return: Friday, August 14, 2015.

I have tried to use the date function, weeknum function, but cannot get any consistent results.

If you are using ISO week numbers then this formula will give the date you want

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

where year is in A2 and week number in B2

Format in required date format

With ISO week numbers week 1 always starts on the first Monday on or after 29th December

Assuming the week starts on Sunday and non-ISO week-numbering, the date of the Sunday of Week#1 of any year is given by:

=CHOOSE(WEEKDAY(DATE(A2,1,1)),DATE(A2,1,1),DATE(A2,1,1)-1,DATE(A2,1,1)-2,DATE(A2,1,1)-3,DATE(A2,1,1)-4,DATE(A2,1,1)-5,DATE(A2,1,1)-6)

Then add 5 to move to Friday. Then add:

(B2-1)*7

to advance to the proper week:

=CHOOSE(WEEKDAY(DATE(A2,1,1)),DATE(A2,1,1),DATE(A2,1,1)-1,DATE(A2,1,1)-2,DATE(A2,1,1)-3,DATE(A2,1,1)-4,DATE(A2,1,1)-5,DATE(A2,1,1)-6)+5+(B2-1)*7

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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