Nested IF AND statements
I am trying to add logic to a nested IF statement that would allow me to ask a question in a form. I am using the following nested if statement without issue.
=IF(WEEKDAY([Date Created]@row) = 7, [Date Created]@row - 1, IF(WEEKDAY([Date Created]@row) = 1, [Date Created]@row - 2, IF(WEEKDAY([Date Created]@row) = 2, [Date Created]@row - 3, IF(WEEKDAY([Date Created]@row) = 3, [Date Created]@row - 4, IF(WEEKDAY([Date Created]@row) = 4, [Date Created]@row - 5, IF(WEEKDAY([Date Created]@row) = 5, [Date Created]@row - 6, IF(WEEKDAY([Date Created]@row) = 6, [Date Created]@row)))))))
On Thursday, I would like to add logic to check if the submission is for current week or last week. Standalone this if statement works but when I try to incorporate it into the IF statement above it doesn't work. I also tried to combine the statement below to add another day to it but get #Incorrect Argument.
=IF(AND(WEEKDAY([Date Created]@row) = 5, [Thursday Today]@row = "Current Week"), [Date Created]@row + 1, [Date Created]@row - 6)
I'm at a loss on what is the best approach to take to combine the IF statement to get what I need. Any help would be greatly appreciated.
Thanks in advance!
Best Answer
-
Try this:
=IF(WEEKDAY([Date Created]@row) = 7, [Date Created]@row - 1, IF(WEEKDAY([Date Created]@row) = 1, [Date Created]@row - 2, IF(WEEKDAY([Date Created]@row) = 2, [Date Created]@row - 3, IF(WEEKDAY([Date Created]@row) = 3, [Date Created]@row - 4, IF(WEEKDAY([Date Created]@row) = 4, [Date Created]@row - 5, IF(WEEKDAY([Date Created]@row) = 5, IF([Thursday Today]@row = "Current Week", [Date Created]@row +1, [Date Created]@row - 6), IF(WEEKDAY([Date Created]@row) = 6, [Date Created]@row)))))))
Answers
-
Try this:
=IF(WEEKDAY([Date Created]@row) = 7, [Date Created]@row - 1, IF(WEEKDAY([Date Created]@row) = 1, [Date Created]@row - 2, IF(WEEKDAY([Date Created]@row) = 2, [Date Created]@row - 3, IF(WEEKDAY([Date Created]@row) = 3, [Date Created]@row - 4, IF(WEEKDAY([Date Created]@row) = 4, [Date Created]@row - 5, IF(WEEKDAY([Date Created]@row) = 5, IF([Thursday Today]@row = "Current Week", [Date Created]@row +1, [Date Created]@row - 6), IF(WEEKDAY([Date Created]@row) = 6, [Date Created]@row)))))))
-
Hi Paul,
Thank you so much! This solved my problem, I appreciate your quick response. Thank you!!
Regards,
Candy
-
Happy to help. 👍️
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 65.1K Get Help
- 443 Global Discussions
- 140 Industry Talk
- 472 Announcements
- 5K Ideas & Feature Requests
- 129 Brandfolder
- 150 Just for fun
- 71 Community Job Board
- 497 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 35 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!