ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   New Years Day formula? (https://www.excelbanter.com/excel-discussion-misc-queries/108481-new-years-day-formula.html)

Richard

New Years Day formula?
 
This there a formula for calling up the first Monday if January 1st falls on
a weekend? Here's what I use now. It works fine as long as Jan 1st falls on a
Sunday but doesn't work if Jan 1st falls on a Saturday which is 2011.
=DATE(TheYear,1,1)+CHOOSE(WEEKDAY(DATE(TheYear,1,1 ),1),1,0,0,0,0,0,-1)
Thanks in Advance!

Earl Kiosterud

New Years Day formula?
 
Richard,

I haven't tested this real thoroughly, but it seems to work:

=DATE(TheYear,1,1)+CHOOSE(WEEKDAY(DATE(TheYear,1,1 ),2),0,0,0,0,0,2,1)

--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Richard" wrote in message
...
This there a formula for calling up the first Monday if January 1st falls
on
a weekend? Here's what I use now. It works fine as long as Jan 1st falls
on a
Sunday but doesn't work if Jan 1st falls on a Saturday which is 2011.
=DATE(TheYear,1,1)+CHOOSE(WEEKDAY(DATE(TheYear,1,1 ),1),1,0,0,0,0,0,-1)
Thanks in Advance!




Roger Govier

New Years Day formula?
 
Hi Richard

With your date in cell A1
=A1+(MAX(0,2-MOD(A1,7)))
seems to produce the result you want.

--
Regards

Roger Govier


"Richard" wrote in message
...
This there a formula for calling up the first Monday if January 1st
falls on
a weekend? Here's what I use now. It works fine as long as Jan 1st
falls on a
Sunday but doesn't work if Jan 1st falls on a Saturday which is 2011.
=DATE(TheYear,1,1)+CHOOSE(WEEKDAY(DATE(TheYear,1,1 ),1),1,0,0,0,0,0,-1)
Thanks in Advance!




Richard

New Years Day formula?
 
Thanks so much, It works great. How the heck do you guys do it!!!!

"Earl Kiosterud" wrote:

Richard,

I haven't tested this real thoroughly, but it seems to work:

=DATE(TheYear,1,1)+CHOOSE(WEEKDAY(DATE(TheYear,1,1 ),2),0,0,0,0,0,2,1)

--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Richard" wrote in message
...
This there a formula for calling up the first Monday if January 1st falls
on
a weekend? Here's what I use now. It works fine as long as Jan 1st falls
on a
Sunday but doesn't work if Jan 1st falls on a Saturday which is 2011.
=DATE(TheYear,1,1)+CHOOSE(WEEKDAY(DATE(TheYear,1,1 ),1),1,0,0,0,0,0,-1)
Thanks in Advance!






All times are GMT +1. The time now is 08:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com