Listing only the workdays of a month
On Mon, 11 Jan 2010 01:46:01 -0800, Joe wrote:
I want a formula that can check on a date such as 1/1/2010 and return all the
work days for January for example.
I used:
=WORKDAY(DATE(YEAR($A$1),MONTH($A$1)+1,1),-21)
and then in the cell below it:
=WORKDAY(DATE(YEAR($A$1),MONTH($A$1)+1,1),-20)
and on down to get all the days listed.
However I need some kind of check on the month I am pulling the date from so
it does not go over into the previous or following month depending on how
many days in a month.
Try this:
A1: The *first* of the month
A2:
=IF(ROWS($1:1)NETWORKDAYS($A$1,EOMONTH($A$1,0),Ho lidays),
"",WORKDAY($A$1-1,ROWS($1:1),Holidays))
and fill down as far as you want, at least as far as the maximum number of
workdays in any month.
The EOMONTH function requires the Analysis ToolPak be installed for versions of
Excel prior to 2007. (See HELP for the function for how to do this).
If this is not possible, and if you wanted to have ANY date in the month in A1,
then you could use this:
=IF(ROWS($1:1)NETWORKDAYS($A$1-DAY($A$1)+1,DATE(YEAR($A$1-DAY($A$1)+1),
MONTH($A$1-DAY($A$1)+1)+1,0),Holidays),"",WORKDAY($A$1-DAY($A$1)+1-1,ROWS($1:1),Holidays))
--ron
|