Maybe you would like the full explanation as to how the function works then.
The reason the formula needs to be array-entered is so this part of it,
ROW($1:$31), will be iterated and output 1, 2, 3,...etc..., 30 and 31. The
TEXT function that it is embedded in will force each of those values to be a
2-digit (leading zero where necessary) value. That 2-digit value is
concatenated with the 4-digit year and 2-digit (leading zero where
necessary) month, with dashes separating each part. So, for a date in, say,
February 2007, the concatenated values generated for each value from
ROW($1:$31) that is induced from array-entering the formula would be
these...
2007-02-01
2007-02-02
2007-02-03
.....
.....
2007-02-28
2007-02-29
2007-02-30
2007-02-31
The only part of the above that would change for any month in 2007 is the
middle number (in this case, the 02). Yes, I know there is no 29th, 30th or
31st in February... we'll discuss that in a moment. The reason for
generating dates in the above format is because it is an internationally
recognized universal date format and Excel knows that. So, when I multiply
each of those concatenated, date-looking strings by the double unary (--),
Excel will convert them into real Excel dates if it can. For those values
like 2007-02-30 which are not a real date, Excel will generate a #VALUE!
error. The next thing the formula does is attempt to find the WEEKEND
numbers for each of the generated dates, producing the numbers I posted in
my previous reply for the real dates and #VALUE! errors for those generated
"dates" that are not real. Next, the IF function tests each of those
generated WEEKDAY numbers to see they meet the condition being tested for
(<6 for the weekday question) and generates a 1 when the conditions are met
and the empty string when they are not (that is, dates during the weekend
and #VALUE! errors). Finally, the COUNT function, which only counts numeric
results, counts all the 1s that were generated from processing each date
generated when ROW($1:$31) was iterated by the array evaluation process
induced by array-entering the formula.
Rick