Re: WEEKDAY()



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" <someone@xxxxxxxxxxxxxxxxxxx> wrote in message
news:OCAu0E60GHA.2400@xxxxxxxxxxxxxxxxxxxxxxx
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


.



Relevant Pages

  • RE: [newbie] rounding anomaly
    ... maybe my calculator is incorrect? ... "Sheeloo" wrote: ... The underlying value is used in calculations and not the displayed value ... It is noted when selecting the 'Excel' link within these discussion ...
    (microsoft.public.excel.misc)
  • Re: how to sort number properly in excel?
    ... Excel sorts based on the underlying value, not the format. ...
    (microsoft.public.excel.misc)
  • RE: [newbie] rounding anomaly
    ... I get 507.32 with Excel as well as my calculator.. ... The underlying value is used in calculations and not the displayed value ... appropriate forum from a list of Microsoft products, ...
    (microsoft.public.excel.misc)
  • Re: How to Avoid Rounding Errors
    ... > As I understand it Excel displays data according to the Format of a Cell but ... > calculates using the underlying value. ... > Round() in every calculation (and I'm assuming here the this will force ...
    (microsoft.public.excel.programming)
  • How to Avoid Rounding Errors
    ... As I understand it Excel displays data according to the Format of a Cell but ... calculates using the underlying value. ... Round() in every calculation (and I'm assuming here the this will force ...
    (microsoft.public.excel.programming)

Loading