Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If statement (2007)

    Hi All,
    Further to my date/time grid, I want to calculate some values based on the contents of one cell. I have one row with a date in dd-mmm-yy format. The next row is in ddd format showing Mon for Monday Tue for Tuesday, etc. I want to do a test to see if the row with the ddd format says "Sat", then calculate based on that. In another cell, I have made an IF that looks to the ddd row for a value of "Sat" but it is not working. I am sure it has something to do with the IF looking for a text string. Does anyone have any ideas?

    Thanks,
    Mark

  2. #2
    Platinum Lounger
    Join Date
    Jan 2001
    Posts
    3,788
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: If statement (2007)

    With the date in cell A1 create a formula based on this:
    <code>=IF(WEEKDAY(A1)=7,Calculation if Saturday, Calculation for other days)</code>


    The cell that displays "Sat" still contains a date, the WEEKDAY function will result in 7 if it is a Saturday.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: If statement (2007)

    Further to Tony's answer, it also depends how you treat your week. Some countries state Sunday is the first day of the week, whilst I treat Monday as the start.

    Using Tony's formula:

    =IF(WEEKDAY(A1,1)=7,Calculation if Saturday, Calculation for other days) , where Sunday is day 1 and Saturday day 7

    or

    =IF(WEEKDAY(A1,2)=6,Calculation if Saturday, Calculation for other days), where Monday is day 1 and Sunday day 7
    Jerry

Posting Permissions

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