Multiple Checkboxes in Formula Field IF OR AND

I have a Flow screen with 29 checkboxes. Based on 1 or many selected, I need to create a formula, that evaluates when the checkbox is checked, put some text, if not checked, no action (except go to the next checkbox and evaluate).

I have the formula working when I select only AA but if I add another IF, I only get AA. if({!checkboxAA},'AA', if({!checkboxAT_ATH},'AT', NULL))

I have read and read looking for formula help and can't find an example to help. If you have tried to work with formulas in a flow, you understand the pain! Can anyone get me started on fixing my formula? Do I use AND / OR?

This works fine: if({!checkboxAA},'AA', NULL)

This gives error:

if(({!checkboxAA}, 'AA') ,if({!checkboxAT_ATH}, 'AT') , NULL)

You definitely don't want to use AND or OR to try and come up with every possible combination. That would require you to write a total of 229 (536,870,912) possible combinations into your formula. However, you can use IF with string concatenation (&):

IF({!checkboxAA}, 'AA,', '') &
IF({!checkboxAT_ATH}, 'AT,', '') &
... and so on ...

Or, you could use 29 different decision and assignment nodes nodes to build up the string in a longer, but easier to understand, pattern.

At this point, though, you're probably better off writing code. Flows are great up to a point, but this monstrosity you're trying to build is likely going to be very hard to build, and even harder to maintain. I won't give a specific cutoff when you should choose Apex/LWC/Aura/Visualforce over Flow, but I'm pretty 29 possible combinations is probably that well past that tipping point.

• Thanks for the reply! I'm not following how this would be so many permutations. Maybe I need to rethink my approach but this can't be an uncommon use case. Aug 27 '21 at 13:31
• @RhondaGutman Using OR/AND (it would be AND, by the way), you'd have to write if(and({!c1}, not({!c2}, not({!c3}),...not({!c29}), 'AA', if(and(not({!c1}), {!c2}, not(!c3})..., 'AT', ...if(and({!c1},{!c2},....,'AAAT', ... so a total of 500m+ permutations. Text concatenation, as described in my answer, is only 29 if statements, but may be difficult to control the output exactly as you'd like. Aug 27 '21 at 13:35

I wasn't sure if I needed the OR/AND and I don't. I modified the CheckboxCombine formula and this works! I was overcomplicating from my Excel days...a Plus sign is all that is needed!

IF({!checkboxAA},'AA, ','') + IF({!checkboxAT_ATH},'AT_ATH, ','') + IF({!checkboxDE},'DE, ','')

I get a returned string of AA,AT_ATH,DE when all 3 are selected and individual values if 1 or 2.

Just another note, using Excel to do the heavy lifting on the 29 checkboxes and formula creation, makes it much easier!