Nest IF Statement

Options

Hello,


I could sure use your help. I have multiple nested IF statements that I cannot seem to get to work correctly. Here is what I am trying to achieve:


IF Date is Blank, Leave the cell blank

IF MONTH = 1, return Jan

IF MONTH = 2, return Feb, etc, etc.

I can get the blank part to work but it won't seem to go past that to return a month if there is a date. Here is my formula:

=IF([Publish Start Date]@row = "", "", IF(MONTH([Publish Start Date]@row = 1, "Jan", IF(MONTH([Publish Start Date]@row = 2, "Feb", IF(MONTH([Publish Start Date]@row = 3, "Mar", IF(MONTH([Publish Start Date]@row = 4, "Apr", IF(MONTH([Publish Start Date]@row = 5, "May", IF(MONTH([Publish Start Date]@row = 6, "Jun", IF(MONTH([Publish Start Date]@row = 7, "Jul", IF(MONTH([Publish Start Date]@row = 8, "Aug", IF(MONTH([Publish Start Date]@row = 9, "Sept", IF(MONTH([Publish Start Date]@row = 10, "Oct", IF(MONTH([Publish Start Date]@row = 11, "Nov", IF(MONTH([Publish Start Date]@row = 12, "Dec")))))))))))))))))))))))))

Tags:

Best Answer

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

    When you wrap up a formula, Smartsheet will automatically add missing closing parenthesis to the end. Since you did not have the MONTH functions closed out, it automatically added 12 closing parenthesis to the end of the formula.


    Essentially these 12 should have been moved to their respective positions to close out each MONTH function, but it looks like instead you basically "added" closing parenthesis after each MONTH function. Since that is the case (added instead of moved), you now have 12 too many closing parenthesis at the end of your formula.


    You have 13 IF statements which means there should only be (in this particular case) 13 closing parenthesis at the end of the formula. I bet if we took the time to count there would be 25 (13 + 12).


    Try removing these now extra closing parenthesis from the end of the formula and see if that works.

Answers

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Options

    Your parenthesis need some adjustments. You are forgetting to close out each of the MONTH functions.

    IF(MONTH([Publish Start Date]@row) = 1, "Jan", IF(MONTH([Publish Start Date]@row) = 2, "Feb",

  • BTMarketingOps
    BTMarketingOps ✭✭✭✭
    Options

    That still didn't work. Do I need something on the first iF?:

    =IF([Publish Start Date]@row = "", "", IF(MONTH([Publish Start Date]@row) = 1, "Jan", IF(MONTH([Publish Start Date]@row) = 2, "Feb", IF(MONTH([Publish Start Date]@row) = 3, "Mar", IF(MONTH([Publish Start Date]@row) = 4, "Apr", IF(MONTH([Publish Start Date]@row) = 5, "May", IF(MONTH([Publish Start Date]@row) = 6, "Jun", IF(MONTH([Publish Start Date]@row) = 7, "Jul", IF(MONTH([Publish Start Date]@row) = 8, "Aug", IF(MONTH([Publish Start Date]@row) = 9, "Sept", IF(MONTH([Publish Start Date]@row) = 10, "Oct", IF(MONTH([Publish Start Date]@row) = 11, "Nov", IF(MONTH([Publish Start Date]@row) = 12, "Dec")))))))))))))))))))))))))

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

    When you wrap up a formula, Smartsheet will automatically add missing closing parenthesis to the end. Since you did not have the MONTH functions closed out, it automatically added 12 closing parenthesis to the end of the formula.


    Essentially these 12 should have been moved to their respective positions to close out each MONTH function, but it looks like instead you basically "added" closing parenthesis after each MONTH function. Since that is the case (added instead of moved), you now have 12 too many closing parenthesis at the end of your formula.


    You have 13 IF statements which means there should only be (in this particular case) 13 closing parenthesis at the end of the formula. I bet if we took the time to count there would be 25 (13 + 12).


    Try removing these now extra closing parenthesis from the end of the formula and see if that works.

  • BTMarketingOps
    BTMarketingOps ✭✭✭✭
    Options

    Yes, that worked and good to know! Thank you, thank you, thank you!!! You just saved me hours of headache!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!