February 13, 200223 yr hi there i just did to calculate a simple payroll date. what ever date you enter it needs to go back to the monday of that week.
February 14, 200223 yr Monday is the second day of the week. Work out what the day-of-week of the date is (using the DayOfWeek function) subtract it from the date, then add 2 to it. It could be written as... Date - DayofWeek(Date) + 2 If the date is a Sunday the calculation will return the folling day as the Monday date. Cool. And I make it look sooooo easy! PS the DayOfWeek function returns 1 for Sunday and 7 for Saturday, at least for the US/English/Australian version I use. This calculation may break for other localised versions (like Sweden?) that start their week on Monday -- I cannot test it so I don't know, but be aware.
Create an account or sign in to comment