Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default 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   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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
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
Silly question Darrell_Sarrasin via OfficeKB.com Excel Worksheet Functions 6 May 11th 07 01:08 PM
Silly question about using dates Zerosumgame Excel Discussion (Misc queries) 5 April 1st 06 03:37 AM
Silly question ksnapp[_41_] Excel Programming 3 April 6th 04 07:59 AM
Silly Question Mick Southam Excel Programming 4 January 6th 04 09:32 PM
Simply silly question paul Excel Programming 7 August 5th 03 11:38 PM


All times are GMT +1. The time now is 04:44 PM.

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

About Us

"It's about Microsoft Excel"