Nest IF Statement
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")))))))))))))))))))))))))
Best Answer
-
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
-
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",
-
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")))))))))))))))))))))))))
-
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.
-
Yes, that worked and good to know! Thank you, thank you, thank you!!! You just saved me hours of headache!
-
Happy to help. 👍️
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 65.2K Get Help
- 445 Global Discussions
- 143 Industry Talk
- 476 Announcements
- 5K Ideas & Feature Requests
- 84 Brandfolder
- 150 Just for fun
- 71 Community Job Board
- 488 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 301 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!