Something like COUNTIF in XLS / Kobo

Hi @nmuser
Thanks for clarifying. I looked at your form and recommended a much shorter solution that uses few questions but does what

You will notice the section that does the trick for you uses the function not selected with the if command. I must say there is still a much shorter way of doing it but could get messy, so will stick to this for now. The formula I applied is here

(if((count-selected(${domain9}))>=“3”,1,0))+(if((count-selected(${domain9}))=“2”,2,0))+(if((count-selected((${domain9}))=“1” and not(selected(${domain9},‘0’))) ,3,0))+(if((count-selected((${domain9}))=“1” and selected(${domain9},‘0’)) ,5,0))

I also added on the domain9 question a constraint that checks to ensure that when you choose no assistance you cannot chose anything else; this controls for the behavior you may have wanted in the form.

. = ‘0’ or not(selected(.,‘0’))

You can access the from created here Count_Selected_Formula.xlsx (11.0 KB)

With the behaviors you expected shown in the below images. Hope this helps
Nothing selected

No Assistance Selected
image

When you try selecting no assistance with something else: Note you can adjust your message to say "You cannot select No Assistance with something else.
image

One option selected

2 Options selected

3 options and above selected

Stephane

1 Like