# If statement to score 'select many' responses

Hi,

I am trying to calculate the score of a select many question. There are four responses and, in this case, the user needs to select three of them correctly to get a mark. I have tried using:

if(selected(\${Work},‘a’) and selected(\${Work},‘b’) and selected(\${Work},‘d’),1,0)

but if they select all answers (a,b,c,d) they are awarded a mark. Any advice on how to only include the correct answers would be appreciated.

Thanks!

Hi @Kal_Lam,

Thanks for the welcome and the quick response. I think I have previously looked at that thread and noted it didn’t quite do what I needed. My understanding from the example is each question has a score which is then summed, whereas I need the calculation to only give one point if they selected three correct answers, any other combination would result in 0 points.

OK, could you kindly share with us your condition (possibly with a short dummy question and a response) so that we could see how it looks like.

If responses a, b, and c are selected then user gets 1 point, otherwise user gets 0 points.

Dummy Q (select many) - What themes do you work with? Select all that apply.

a) Maternal Health
b) Newborn Health
c) Construction
d) m-Health

1 Like

Should all a, b and c all get selected or should a, b or c (any of them get selected)?

Maybe the image outlined below should solve your issue:

### Reference xlsform:

Calculation.xlsx (11.6 KB)

1 Like

Ah great, thank you so much. So I was just missing the not(selected) part of the statement - it seems so obvious now. Thanks again - have a great weekend!

2 Likes