+ Reply to Thread
Results 1 to 8 of 8

[SOLVED] What a silly question !

  1. #1
    tom
    Guest

    [SOLVED] 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. #2
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187
    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

  3. #3
    NickHK
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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




  4. #4
    Niek Otten
    Guest

    Re: 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" <[email protected]> wrote in message news:[email protected]...
    | 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. #5
    Simon Cleal
    Guest

    RE: 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. #6
    Tom
    Guest

    RE: 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. #7
    Tom
    Guest

    Re: 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" <[email protected]> wrote in message news:[email protected]...
    > | 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. #8
    NickHK
    Guest

    Re: What a silly question !

    Tom,
    Use Niek's option then.

    NickHK

    "Tom" <[email protected]> wrote in message
    news:[email protected]...
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1