Formula IF, nest AND in OR

Options

Hello there,

I have two columns of data with days employees work with drop down selection (M, Tu, W, Th, F, S, Su) and a cell linked date $TODAY$1. I want to return today's date if it is on the day of the week the employee is schedule to work. The formula below have no errors, but it is not returning the values on test dates:

=IF(OR([Days of Week]@row = "Su", WEEKDAY($TODAY$1) = 1), $TODAY$1, IF(AND([Days of Week]@row = "M", WEEKDAY($TODAY$1) = 2), $TODAY$1, IF(AND([Days of Week]@row = "Tu", WEEKDAY($TODAY$1) = 3), $TODAY$1, IF(AND([Days of Week]@row = "W", WEEKDAY($TODAY$1) = 4), $TODAY$1, IF(AND([Days of Week]@row = "Th", WEEKDAY($TODAY$1) = 5), $TODAY$1, IF(AND([Days of Week]@row = "F", WEEKDAY($TODAY$1) = 6), $TODAY$1, IF(AND([Days of Week]@row = "S", WEEKDAY($TODAY$1) = 7), $TODAY$1)))))))

Please help.

Thank you!

Best Answers

  • Tracy Huang
    Tracy Huang ✭✭
    Answer ✓
    Options

    This seems to have worked. Hopefully, I covered all logistical conditions. Fingers crossed.

    =IF(AND(HAS([Days of Week]@row, "Su"), WEEKDAY($TODAY$1) = 1), $TODAY$1, IF(AND(HAS([Days of Week]@row, "M"), WEEKDAY($TODAY$1) = 2), $TODAY$1, IF(AND(HAS([Days of Week]@row, "Tu"), WEEKDAY($TODAY$1) = 3), $TODAY$1, IF(AND(HAS([Days of Week]@row, "W"), WEEKDAY($TODAY$1) = 4), $TODAY$1, IF(AND(HAS([Days of Week]@row, "Th"), WEEKDAY($TODAY$1) = 5), $TODAY$1, IF(AND(HAS([Days of Week]@row, "F"), WEEKDAY($TODAY$1) = 6), $TODAY$1, IF(AND(HAS([Days of Week]@row, "S"), WEEKDAY($TODAY$1) = 7), $TODAY$1, 0))))))) 

Answers

  • Tracy Huang
    Options

    Below is a screenshot of my columns. I think I need to use CONTAINS function as well, but have not had success.


  • Tracy Huang
    Tracy Huang ✭✭
    Answer ✓
    Options

    This seems to have worked. Hopefully, I covered all logistical conditions. Fingers crossed.

    =IF(AND(HAS([Days of Week]@row, "Su"), WEEKDAY($TODAY$1) = 1), $TODAY$1, IF(AND(HAS([Days of Week]@row, "M"), WEEKDAY($TODAY$1) = 2), $TODAY$1, IF(AND(HAS([Days of Week]@row, "Tu"), WEEKDAY($TODAY$1) = 3), $TODAY$1, IF(AND(HAS([Days of Week]@row, "W"), WEEKDAY($TODAY$1) = 4), $TODAY$1, IF(AND(HAS([Days of Week]@row, "Th"), WEEKDAY($TODAY$1) = 5), $TODAY$1, IF(AND(HAS([Days of Week]@row, "F"), WEEKDAY($TODAY$1) = 6), $TODAY$1, IF(AND(HAS([Days of Week]@row, "S"), WEEKDAY($TODAY$1) = 7), $TODAY$1, 0))))))) 

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!