• If statement (2007)

    Author
    Topic
    #448662

    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

    Viewing 1 reply thread
    Author
    Replies
    • #1097884

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

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

    • #1097885

      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

    Viewing 1 reply thread
    Reply To: If statement (2007)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: