LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,572
Default WEEKDAY()

Probably the reason 21/4/2008 doesn't work for you is because your regional
settings aren't set-up as d/m/y, BUT as m/d/y.

It *would* work on Bob's machine because he probably has the European short
date set-up in his regional settings.

And of course, 2008/04/21 should work *everywhere*, since it's recognized as
international.
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Epinn" wrote in message
...
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")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Epinn" wrote in message
...
Regarding WEEKDAY(), I read that problems can occur if dates are entered as
text.

Based on this, it is understandable that =WEEKDAY(2/14/2008) returns a wrong
result (7). This is because general format is same as text.

If I enter =WEEKDAY(DATE(2008,2,14)), I get the correct result (5).

Okay, so far. What I don't understand is the following.

I click A1 and key in 2/14/2008, then in A2, I key in =WEEKDAY(A1). I also
get the correct result (5).

The way I enter 2/14/2008 to A1 is exactly the same as I enter 2/14/2008
*directly* to the formula. It amazes me that referencing A1 in WEEKDAY()
gives me the correct answer whereas keying it in as part of the formula
won't work.

Comments welcome.

Epinn



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Function to write Weekday - Monday, Tuesday etc Shrikant Excel Discussion (Misc queries) 3 September 26th 05 11:32 AM
Forecasting weekday occupancy between two years titushanke Excel Worksheet Functions 0 September 14th 05 01:43 PM
Conditional formatting using weekday violasrbest Excel Discussion (Misc queries) 4 May 6th 05 10:02 AM
weekday display in excel abbylulu2 Excel Worksheet Functions 2 January 30th 05 02:47 PM
Weekday Function John Excel Worksheet Functions 2 January 7th 05 11:39 AM


All times are GMT +1. The time now is 10:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"