# Adding checkbox coded question responses

**URL:** <https://forum.dimagi.com/t/adding-checkbox-coded-question-responses/8920>\
**Category:** Users\
**Created:** [April 19, 2022, 1:12pm UTC](https://forum.dimagi.com/t/adding-checkbox-coded-question-responses/8920 "2022-04-19T13:12:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edu](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/e/cdc98d/32.png) [@Edu](https://forum.dimagi.com/u/Edu)\
**Post date:** [April 19, 2022, 1:12pm UTC](https://forum.dimagi.com/t/adding-checkbox-coded-question-responses/8920/1 "2022-04-19T13:12:39Z")

</div>

Hi, is there a formula one can use in adding the scores of a checkbox question, with each response coded to a specific number?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Clayton\_Sims](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/clayton_sims/32/496_2.png) [@Clayton\_Sims](https://forum.dimagi.com/u/Clayton_Sims)\
**Post date:** [April 19, 2022, 1:50pm UTC](https://forum.dimagi.com/t/adding-checkbox-coded-question-responses/8920/2 "2022-04-19T13:50:18Z")

</div>

Hm, if you want a weighted sum I think the easiest way to achieve it would be to make a quick [lookup table](https://confluence.dimagi.com/display/commcarepublic/Lookup+Tables) for the list of choices and include the scores for each choice in the table.

Then you could calculate a score by [referencing the table](https://confluence.dimagi.com/display/commcarepublic/Example%3A+In-Form+Lookup+Table+Querying) and summing each item which has a selection. Something like the following:

sum(instance('item-list:fruit')/fruit\_list/fruit[selected(#form/selected\_choices, type)]/score)

---

<div class="post-metadata">

**Author:** ![Edu](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/e/cdc98d/32.png) [@Edu](https://forum.dimagi.com/u/Edu)\
**Post date:** [April 20, 2022, 8:14am UTC](https://forum.dimagi.com/t/adding-checkbox-coded-question-responses/8920/3 "2022-04-20T08:14:29Z")

</div>

Thank you for the swift reply, but let's say I have a checkbox question like:  
What did you have for breakfast?  
a) Cereals  
b) Tea  
c) Bread  
d) Eggs  
e) pancakes  
Suppose we need a score for breakfast and we allocate a score for each response : Cereals (1), Tea (2), Bread (2), Eggs (4), Pancakes (1)  
How can one go about it?
