I have a week number in Cell C13 and a year in Cell C14.
I am using the below formula to convert this into the Thursday of that week number's date:
=DATE(C14,1,-6)-WEEKDAY(DATE(C14,1,3))+C13*7
How could i do the same thing using VBA?
I have a week number in Cell C13 and a year in Cell C14.
I am using the below formula to convert this into the Thursday of that week number's date:
=DATE(C14,1,-6)-WEEKDAY(DATE(C14,1,3))+C13*7
How could i do the same thing using VBA?
As an additional option, for those using the ISO weeknumber system, where Week 1 of the year is the first week of the year containing four days (or the week that includes the first Thursday of the calendar year, and the first day of the week is Sunday.
For a specific year, you can do it like this :
And to test it :
If others are looking into this and don't want a Thursday or don't work on 2017 :
change the 5 to fit your need!
Or use the below function
GetDayFromWeekNumber
Code to test it :
And the generic function
GetDayFromWeekNumber
:It works quite ok, taking in mind that the first day of the week is Sunday:
You have to pass which day do you want as third parameter. Thursday is day number 5. Credits to these guys: http://www.dreamincode.net/forums/topic/111464-calculate-date-from-year-weeknr-and-daynumber/