I have to put scores for my answers and Iβm getting errors! I have a question about age as the following:
Age:

1. 50+
2. 18 - 24
3. 25 -49
and each option of these should have a score. option 1 should have a zero score, option 2 should have a 2 score and option 3 should have a 4 score.
I am not able to configure the if statements and so on! also I started this project freshly on Kobo toolbox meaning that I do not have it on Excel.
I have been trying several formulas including: if(selected(\${age},β0β),β0β,ββ),if(selected(\${age},β2β),β2β,ββ),if(selected(\${age},β4β),β4β,ββ))

but it is not working!

Welcome @basselalkan,
You need to keep to the syntax of a cascading if.
if( selected(\${age},β0β), β0β if( selected(\${age},β2β), β2β, if( selected(\${age},β4β), β4β, ββ ) ) ).
A following if is replacing an else part.

Or - as this seems a select_one - yo donβt need selected and could use if( \${age} = β0β, β0β, ifβ¦

Why do you create an extra score, if the values are the same? Or did you put the wrong figures in your example? Different to your text.

If the mapping is such simple, you could just adapt the names/code of the age groups.
Or it could be score =
string( number(coalesce(\${age}), β0β)) + 1 )

Maybe you can provide a table how you want to map between age and score.

1 Like