How to score different percentage ranges from an integer input value

Thank you Kal and other members who have been a great help to a complete novice like me.
I would like to ask for your assistance regarding this. I would like to add scores to a percentage extent of body surface area affected…
So when someone inputs a value of 0, 1-9, 10-29, 30-49, 50-69, 70-89, 90-100% it returns a score of 0, 1, 2, 3, 4, 5, 6, respectively.
I tried to put this in the calculation line but I get an error message.
if((${extent} = 0), ‘0’, if(${extent} >0 and ${extent} <10), ‘1’, if(${extent} >9 and ${extent} <30), ‘2’, if(${extent} >29 and ${extent} <50), ‘3’, if(${extent} >49 and ${extent} <70), ‘4’, if(${extent} >69 and ${extent} <90), ‘5’, if(${extent} >89 and ${extent} <101), ‘6’))
Attached is the file
Really grateful if anyone can help
Kah
BSA-V1.xlsx (8.9 KB)

Maybe you could do it as outlined in the image shared below:

In the survey tab of your xlsform:

Data entry screen as seen in Enketo:

Data entry screen as seen in Enketo:

Reference xlsform (edited):

BSA-V1.xlsx (10.4 KB)

1 Like

Great Kal. Thank you so much.
Kah

1 Like