WEEKDAY()
Because weekday(21/4/2008) does give an error
as it treats 21/4/2008 as 21/4 divided by 2008 - nearly 0
ie 0/1/1900 in date terms
Odd but thats what's happening
Steve
On Sat, 09 Sep 2006 01:52:22 +0100, Epinn
wrote:
Bob,
Glad I still caught you this late. Thank you for enlightening me.
<<21/4/2008 is not a number here, so it errors.
If it gives me an error, then I know. The problem is it returns "7"
instead of "5" in my other example. That's very misleading and
dangerous.
=WEEKDAY(--"21/4/2008") gives #VALUE!
=WEEKDAYS(--"4/21/2008") gives 2.
So, I understand why you prefer =WEEKDAY(--"2008-04-21").
But I prefer "/" to "-" and I tested it. I am glad that "/" works too..
My preference will be =WEEKDAY(--"2008/4/21").
I assume "--" above is the same as "--" in SUMPRODUCT(). Please
confirm. Can't find double negating in Help.
I find date functions may be as confusing as SUMPRODUCT().
Will see.
Epinn
"Bob Phillips" wrote in message
...
But the difference is that when you key 21/4/2008 into cell A1, Excel
recognises it as a date and converts it to an underlying value of 39559,
which it presents/formats as that date.
When you enter it into a function, the function treats it as its
argument,
and says that it is invalid as it expects a number (the true underlying
value). 21/4/2008 is not a number here, so it errors.
If you want to enter the date into the WEEKDAY function, you have to
force
it into a number, either using another function such as you did with
DATE,
or coerce it directly, like
=WEEKDAY(--"21/4/2008")
or my preferred format of
=WEEKDAY(--"2008-04-21")
--
Steve (3)
|