What a silly question !

G

Guest

Hi everyone,

I am facing the following situation:

A1= Monday;
A2=if(weekday(A1,2)<6,"Week","Weekend")

in A2, we should have: "Week", if the content of A1= Monday,
Tuesday,...Friday.
Or "Weekend", if the content of A1: Saturday or Sunday.

It doesn't work ! Why ?

Please help me !
Thanks very much
Tom
 
N

NickHK

Tom,
If you read the help on WEEKDAY, you will see it "Returns the day of the
week corresponding to a date".
So you have to pass a date (Now(), "01/12/06" etc).

NickHK
 
T

tony h

I would guess that you have A1 as a string "Monday" rather than a date
which is a monday. try putting 31-aug-2006 in A1

regards
 
N

Niek Otten

Hi Tom,

Your method assumes you have a real Excel date in A1.
If you have text like "Monday":

=IF(OR(A1="Sunday",A1="Saturday"),"weekend","week")

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

| Hi everyone,
|
| I am facing the following situation:
|
| A1= Monday;
| A2=if(weekday(A1,2)<6,"Week","Weekend")
|
| in A2, we should have: "Week", if the content of A1= Monday,
| Tuesday,...Friday.
| Or "Weekend", if the content of A1: Saturday or Sunday.
|
| It doesn't work ! Why ?
|
| Please help me !
| Thanks very much
| Tom
 
G

Guest

It doesn't work becuase "Monday" is text not a date serial number

If you put 22/08/2006 in A1 then it will work

Alternativly you could use =IF(LEFT(A1,1)="S","Weekend","Week")

HTH
Simon
 
G

Guest

Hi Nick and Simon,

Thanks very much for the indication.
However in A1, we must introduce the day in text as: "Monday",
"Tuesday",..."Friday".

and then in A2, we should test whether we are during the week, or it is the
weekend.

Thanks a lot
Tom
 
G

Guest

Hi Niek,

Yes it works !!!

thanks very much for the indication and your kind help.
Thanks very much also to all those who tried to help me.
regards
Tom
 
N

NickHK

Tom,
Use Niek's option then.

NickHK

Tom said:
Hi Nick and Simon,

Thanks very much for the indication.
However in A1, we must introduce the day in text as: "Monday",
"Tuesday",..."Friday".

and then in A2, we should test whether we are during the week, or it is the
weekend.

Thanks a lot
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top