Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
What a silly question !
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
What a silly question !
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 "tom" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
What a silly question !
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 -- tony h ------------------------------------------------------------------------ tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074 View this thread: http://www.excelforum.com/showthread...hreadid=574101 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
What a silly question !
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 "tom" wrote in message ... | 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
What a silly question !
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 "tom" wrote: 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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
What a silly question !
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 "Simon Cleal" wrote: 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 "tom" wrote: 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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
What a silly question !
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 "Niek Otten" wrote: 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 "tom" wrote in message ... | 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 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
What a silly question !
Tom,
Use Niek's option then. NickHK "Tom" wrote in message ... 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 "Simon Cleal" wrote: 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 "tom" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Silly question | Excel Worksheet Functions | |||
Silly question about using dates | Excel Discussion (Misc queries) | |||
Silly question | Excel Programming | |||
Silly Question | Excel Programming | |||
Simply silly question | Excel Programming |