How to get a nested IF statement to work?
My individual IF statements work but when I nest them I get an error. Not sure what I am doing wrong as it should be simple.
Here they are individually:
=IF(ISBLANK([License Research]@row), "Red")
=IF([License Research]@row = "Completed", "Yellow")
=IF([License Status]@row = "Obtained", "N/A", "Green")
Here they are nested:
IF(ISBLANK([License Research]@row), "Red"), IF([License Research]@row = "Completed", "Yellow"), IF([License Status]@row = "Obtained", "N/A", "Green")))
Best Answers
-
You leave each of the IF's open until the very end.
=IF(ISBLANK([License Research]@row), "Red", IF([License Research]@row = "Completed", "Yellow", IF([License Status]@row = "Obtained", "N/A", "Green")))
-
Just need to move that "Green" back to the end is all.
=IF([License Status]@row = "Obtained", "N/A", IF([License Research]@row = "Completed", "Yellow", IF(ISBLANK([License Research]@row), "Red", "Green")))
Answers
-
You leave each of the IF's open until the very end.
=IF(ISBLANK([License Research]@row), "Red", IF([License Research]@row = "Completed", "Yellow", IF([License Status]@row = "Obtained", "N/A", "Green")))
-
Thank you, I knew it was something simple.
-
Happy to help! 👍️
-
I just found a new issue though, I need to actually have it read in this order or it will read the "Completed" argument first and make it "Yellow" when it should be reading the "Obtained" argument and make it "Green".
=IF([License Status]@row = "Obtained", "N/A", "Green", IF([License Research]@row = "Completed", "Yellow", IF(ISBLANK([License Research]@row), "Red")))
When I rearrange them in the above order I get an #incorrect argument set error.
-
Just need to move that "Green" back to the end is all.
=IF([License Status]@row = "Obtained", "N/A", IF([License Research]@row = "Completed", "Yellow", IF(ISBLANK([License Research]@row), "Red", "Green")))
-
Tamee,
I think you have too many arguments in your first IF statement. I also don't believe that order matters, as the statements will evaluate ALL of the cases (unless it finds one that's true) regardless of order.
Think of these in English: If license status field contains obtained, populate field with green, UNLESS license research field contains completed, then populate field with yellow, UNLESS license research field is blank, in which case populate the field with red. If none of these things are there, then populate with N/A. Is this what you want to happen?
If so, then your "N/A" argument just needs to go at the end, after "Red". Optionally, you could just take the N/A out of the statement completely and if none of the arguments are true, the field will be left blank. I used that to troubleshoot some of mine.
Jason Wirl
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 63.5K Get Help
- 402 Global Discussions
- 213 Industry Talk
- 450 Announcements
- 4.7K Ideas & Feature Requests
- 141 Brandfolder
- 135 Just for fun
- 56 Community Job Board
- 454 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 296 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!