...to clarify a bit more, in the calendar that i need ti use the first of January 2006 belongs to the last week of last year. So when format is returning the right week, I need to have the (to the week) corresponding year, not the year that that is in the given date.
Can you use the Weekday function to return a number (1 to 7, obviously) for the day of the week that your date is, use that to calculate a number to subtract from your date value, then format the result.
This is untested and not very well thought out (!) but something like:
In effect this has the effect of working out the date of the first day of the week that the test date falls in. Which I think is what you need...
Even if this looks like it works you might want to play around with other dates around New Year (a bit of boundary analysis testing, you might say) to make sure all is well. Note that Weekday() also takes a second parameter to specify what day of the week you consider to be the first which, looking at the parameters you've specified on the format function, you might need to play with.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.