Avoiding a massive nested IF formula  checkboxes?
Hi all,
I have 5 check boxes and based on these being ticked or unticked i want to display something in another cell.
It is essentially a decision tree that simply i want to work as follows:
If Group 2 is not ticked (or nothing ticked) = Group 1
If Group 2 is ticked but 3, 4, 5 & Close are not = Group 2
If Groups 2 & 3 are ticked but 4, 5 & Close are not = Group 3
If Groups 2, 3 & 4 are ticked but 5 and close are not = Group 4
If Groups 2, 3, 4 & 5 are ticked but close is not = Group 5
If Group 2, 3, 4, 5 & Close are ticked (all are ticked) = Close
Any ways of doing this simpler than building in every possible scenario via nested IFs? It is a linear structure in that 3 will not be ticked before 2 for example which i know avoids me having to do every combination.
Any help is much appreciated.
Thanks,
Jack
Best Answer

Paul Newcome ✭✭✭✭✭
Work backwards with your IF statements. Nested IFs stop on the first true value, so if it makes it to the next one, then the previous IF(s) MUST be false.
=IF([email protected] = 1, "Close",
Starting with this means that everything that follows automatically assumes that [email protected] is NOT checked.
=IF([email protected] = 1, "Close", IF([Group 5]@row = 1, "Group 5",
Anything coming after this portion automatically assumes that [email protected] and [Group 5]@row are both unchecked. So we continue with this logic that "if it has made it this far then everything before it must be false" and work (almost) the rest of your requirements in using the same logic.
=IF([email protected] = 1, "Close", IF([Group 5]@row = 1, "Group 5", IF([Group 4]@row = 1, "Group 4", IF([Group 3]@row = 1, "Group 3", IF([Group 2]@row = 1, "Group 2",
Now that we only have one option left (because to get this far everything prior must be false which means all of those boxes are unchecked), we can just use the "if false" portion of the final IF statement to say that if everything prior is false, "Group 1". Then we close out all of the IF statements all at once and your formula is complete.
=IF([email protected] = 1, "Close", IF([Group 5]@row = 1, "Group 5", IF([Group 4]@row = 1, "Group 4", IF([Group 3]@row = 1, "Group 3", IF([Group 2]@row = 1, "Group 2", "Group 1")))))
thinkspi.com
5
Answers
Work backwards with your IF statements. Nested IFs stop on the first true value, so if it makes it to the next one, then the previous IF(s) MUST be false.
=IF([email protected] = 1, "Close",
Starting with this means that everything that follows automatically assumes that [email protected] is NOT checked.
=IF([email protected] = 1, "Close", IF([Group 5]@row = 1, "Group 5",
Anything coming after this portion automatically assumes that [email protected] and [Group 5]@row are both unchecked. So we continue with this logic that "if it has made it this far then everything before it must be false" and work (almost) the rest of your requirements in using the same logic.
=IF([email protected] = 1, "Close", IF([Group 5]@row = 1, "Group 5", IF([Group 4]@row = 1, "Group 4", IF([Group 3]@row = 1, "Group 3", IF([Group 2]@row = 1, "Group 2",
Now that we only have one option left (because to get this far everything prior must be false which means all of those boxes are unchecked), we can just use the "if false" portion of the final IF statement to say that if everything prior is false, "Group 1". Then we close out all of the IF statements all at once and your formula is complete.
=IF([email protected] = 1, "Close", IF([Group 5]@row = 1, "Group 5", IF([Group 4]@row = 1, "Group 4", IF([Group 3]@row = 1, "Group 3", IF([Group 2]@row = 1, "Group 2", "Group 1")))))
thinkspi.com
Thank you Paul, that perfect.
Jack
Happy to help! 👍️
thinkspi.com