IF/AND formula to enter variable text determined by date.
I am trying to use an IF/AND formula in a column to say that if the date in column Work Completion Date is within a certain date range, enter "Week1", if the dates fall within the next date range, enter "Week 2" all the way to Week 9.
I built out the below and it is not causing an error but there is nothing populating in the cell.
=IF(AND([Work Completion Date]@row >= DATE(20, 10, 18), [Work Completion Date]@row <= DATE(20, 10, 13)), "Week 0", IF(AND([Work Completion Date]@row >= DATE(20, 10, 25), [Work Completion Date]@row <= DATE(20, 10, 19)), "Week 1", IF(AND([Work Completion Date]@row >= DATE(20, 11, 1), [Work Completion Date]@row <= DATE(20, 10, 26)), "Week 2", "")))
Best Answer
-
Try switching your arguments. Right now you have it saying for Week 0 that if the date is greater than 18 Oct and less than 13 Oct. You cannot have a date greater than the 18th and less than the 13 at the same time. If you switch it to say less than the 18 and greater than the 13th (as well as the same switch for the rest of your week numbers) then you should be good to go.
Answers
-
Try switching your arguments. Right now you have it saying for Week 0 that if the date is greater than 18 Oct and less than 13 Oct. You cannot have a date greater than the 18th and less than the 13 at the same time. If you switch it to say less than the 18 and greater than the 13th (as well as the same switch for the rest of your week numbers) then you should be good to go.
-
Hi Paul, I just switched them but it is still showing as blank.
-
Can you show what you are now using?
-
=IF(AND([Work Completion Date]@row <= DATE(20, 10, 18), [Work Completion Date]@row >= DATE(20, 10, 13)), "Week 0", IF(AND([Work Completion Date]@row <= DATE(20, 10, 25), [Work Completion Date]@row >= DATE(20, 10, 19)), "Week 1", IF(AND([Work Completion Date]@row <= DATE(20, 11, 1), [Work Completion Date]@row >= DATE(20, 10, 26)), "Week 2", "")))
-
I figured it out! And your solution did help! I was entering the year within the date as 20 but it needed to be the full 2020. After updating that, with the update you also suggested it is now working!
-
That was going to be my next suggestion. I have never tested using a 2 digit year, so I couldn't have said for sure whether or not that would have affected it. Glad it is working for you now.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 143 Just for fun
- 58 Community Job Board
- 463 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 300 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!