A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Thank you both for your help! Adding 7 gets it right for almost all years.
For example, when entering december 2009 and calculating enough weeks ahead it correctly tags January 4th as the Monday in week 1. But entering January 2010 as start month, it tags January 3rd on Monday week 53, hence Jan 1st would be on Friday week 52?? A similar problem occured around 1999-2000.
Maybe I should start considering rebuilding the entire thing, doing the calculations in a completely different manner?
Try this formula in cell B3 to get the date for the Måndag of the week containing the first of the month without using the result in A3, i.e. the WEEKNUM :
=DATE($B1,MATCH(LEFT($A1,3),{"Jan";"Feb";"Mar";"Apr";"Maj";"Jun";"Jul";"Aug";"Sep";"Okt";"Nov";"Dec"},0),1)-WEEKDAY(DATE($B1,MATCH(LEFT($A1,3),{"Jan";"Feb";"Mar";"Apr";"Maj";"Jun";"Jul";"Aug";"Sep";"Okt";"Nov";"Dec"},0),1),3)+INT(SEARCH(LEFT(B4,2),"MåTiOnToFrLöSö")/2)
This formula calculates the date for the first of the month and then subtracts the WEEKDAY value for the first of the month, using Måndag = 0, Tisdag = 1, ..., Söndag = 6. And finally the day offset for your "nine days week" is added.
Drag the formula across to cell J3.
Then use the +7 method like previously suggested:
In cell B15: =B3+7 and drag it to the right
In cell B27: =B15+7 and drag it to the right
and so on.
Hope this helps / Lars-Åke
Edit: P.S. A slightly shorter alternative to the
INT(SEARCH(LEFT(B4,2),"MåTiOnToFrLöSö")/2
part of the formula is
MID("012345566",COLUMNS($B:B),1)
As the string returned is a single digit, Excel will have no problem using it in the addtion.