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
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!