Thomas Moore
Thomas Moore

Reputation: 981

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.

Upvotes: 1

Views: 4044

Answers (2)

Gary's Student
Gary's Student

Reputation: 96753

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

enter image description here

Upvotes: 1

barry houdini
barry houdini

Reputation: 46331

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

Upvotes: 4

Related Questions