Formula IF, nest AND in OR
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
-
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)))))))
-
Hi Tracy,
Looks good! I'm glad you sorted out the HAS function, which is meant exactly for this type of situation (looking into a mutli-select column).
Thanks for sharing your solution!
Need more information? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao!👋 | Global Discussions
Answers
-
Below is a screenshot of my columns. I think I need to use CONTAINS function as well, but have not had success.
-
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)))))))
-
Hi Tracy,
Looks good! I'm glad you sorted out the HAS function, which is meant exactly for this type of situation (looking into a mutli-select column).
Thanks for sharing your solution!
Need more information? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao!👋 | Global Discussions
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 67.1K Get Help
- 450 Global Discussions
- 155 Industry Talk
- 505 Announcements
- 5.4K Ideas & Feature Requests
- 85 Brandfolder
- 156 Just for fun
- 80 Community Job Board
- 514 Show & Tell
- 34 Member Spotlight
- 2 SmartStories
- 308 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!