Nested IF AND statements

Options

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

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓
    Options

    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

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!