Mal wrote:
Hello,
Any advice on a function to convert a given week number to a date?
Ideally I'd like the first day of that week.
I'm using this to compare year to year....using the week number as the
common factor.
Mal.
Expanding a bit on what others wrote, you can view these results in the
Immediate/Debug window
? format(#1/1/2006#,"ww",vbMonday,vbFirstFourDays)
52
? format(#1/1/2006#,"ww",vbMonday,vbFirstFullWeek)
52
? format(#1/1/2006#,"ww",vbMonday,vbFirstJan1)
1
? format(#1/1/2006#,"ww",vbMonday,vbUseSystem)
1
? weekday(#1/1/2006#,vbSunday)
1
? weekday(#1/1/2006#,vbMonday)
7
1/1/2006 is a Sunday. vbSunday is the default in the Weekday function.
Which day is your default? Sunday, Monday...Saturday?
I guess you'll need to find out what the week number is for the first of
the year. Then if the week day is not the start week day either
increment or decrement the days till you get your start day from the
first of the year. From there you can multiply the number of (weeks-1)
* 7. If the week is 52, you'd want to set the week to 0.