How can i write a syntax to sum or calculate string responses with four option in my xlsform

1. What is the issue? Please be detailed.
i need to learn to write a syntax to sum/count selected options from a question that has four option. i can calculate that of yes/no but not when it's more than two.

2. What steps can we take to reproduce this issue?

3. What have you tried to fix the issue?

4. Upload any forms or screenshots you can share publicly below.

Welcome to the ODK forum, @A_JOSEPH_ENNE ! We're glad you're here. When you get a chance, please introduce yourself on this forum thread. I'd also encourage you to add a picture as your avatar because it helps build community!

Can you please share the question text and the options? It will help in understanding your question.

thank you so much.
i will do the introduction as mentioned and will add the photo. my crucial question is this: i have a couple of questions with responses like these:

  1. 90% and above
  2. Between 50% and 90%
  3. Between 25% and 50%
  4. Less than 25%
    what i need is this: i should have a field with summation of each of these responses when selected as an option. in this care, if option is selected in 4 of the question, i should have a field that will sum(count) and display the '4' for me, like wise the option 2, 3 , and 4.
    thank you

Here is an example using the if() expression.

counting_answers_example.xlsx (10.0 KB)