Re: find the first Monday in June

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Daniel.M (prenom.maher_at_bigfoot.inutil.com)
Date: 07/04/04


Date: Sun, 4 Jul 2004 15:05:41 -0400

Arvi,

MOD() is superfluous for the same reason I gave to Norman: WEEKDAY() is already
a kind of modulo.

> Another way - with 1st of June (or of any month) in A1
> =A1+MOD(9-WEEKDAY(A1),7)

=A1+7-WEEKDAY(A1+5)

> And the same with any date of month in A1
> =DATE(YEAR(A1),MONTH(A1),1)+MOD(9-WEEKDAY(DATE(YEAR(A1),MONTH(A1),1)),7)

=A1-DAY(A1)+8-WEEKDAY(A1-DAY(A1)+6)

Regards,

Daniel M.



Relevant Pages