Use count-selected anf if they mark "None" dont count

Hi i have this problem

i have one question that is select_multiple:

Q1- Wich are youre favorite fruits?

The options are:

*** Apple**
*** Banana**
*** Grape**
*** None**

I want to count the number of selected option but if they mark “None” I want this option not to count in the sum

How can i do it?
aFrS492vYBL5tR5FrBWUrs (1).xlsx (11.0 KB)

1 Like

You may use
count-selected(${Q1}) - if( selected(${Q1}, ‘nameOfNoneOption’), 1, 0 )

3 Likes

@jorgelihber, you could do this as outlined by @wroos above. Here is the breakdown of how it can be done.

In the survey tab of your XLSForm:

In the choices tab of your XLSForm:

Image 2

Data entry screen as seen in Enketo: when nothing is entered

Data entry screen as seen in Enketo: when something is entered but not none

Data entry screen as seen in Enketo: when something is entered along with none

Reference XLSForm:

Count Selected.xlsx (11.4 KB)

2 Likes