# Counting the number of responses from various Questions

Hi community, I would like to count the number of responses of each choice. Could you please help me out with this? I have put the calculation formula but, it seems it is counting differently.

Can you share your formula with us so we can review it? otherwise without knowing the XML values i can only refer you to a relevant document. Maybe this topic can help you Something like COUNTIF in XLS / Kobo - #8 by stephanealoo

1 Like

Thanks @osmanburcu for prompt reply. This is the formula I am using right now.
coalesce(\${aq1},0)+coalesce(\${aq2},0)+coalesce(\${aq3},0)+coalesce(\${aq4},0)+coalesce(\${aq5},0)

This is what you need, I believe. This is the easiest solution I can find and it is working. You can find the XLS for you to review and adjust according to your need.
a9uTxggsR62G5LEcVBRuxF.xlsx (6.5 KB)

Welcome @jwz_meal,
This issue has been discussed already often here. Using the search function of this forum, plese, will show you more, Search results for 'counting the number of responses' - KoboToolbox Community Forum

Hi @osmanburcu,
Here it is the coding. I adjusted the coding as yours, it does not work though.
if(\${aq1}=â€śFully metâ€ť,1,0) + if(\${aq2}=â€śFully metâ€ť,1,0) + if(\${aq3}=â€śFully metâ€ť,1,0)+ if(\${aq4}=â€śFully metâ€ť,1,0)+ if(\${aq5}=â€śFully metâ€ť,1,0)
if(\${aq1}=â€śNot metâ€ť,1,0) + if(\${aq2}=â€śNot metâ€ť,1,0) + if(\${aq3}=â€śNot metâ€ť,1,0)+ if(\${aq4}=â€śNot metâ€ť,1,0)+ if(\${aq5}=â€śNot metâ€ť,1,0)
if(\${aq1}=â€śPartially metâ€ť,1,0) + if(\${aq2}=â€śPartially metâ€ť,1,0) + if(\${aq3}=â€śPartially metâ€ť,1,0)+ if(\${aq4}=â€śPartially metâ€ť,1,0)+ if(\${aq5}=â€śPartially metâ€ť,1,0)

Hi @jwz_meal, your solution is simple. You used the â€śLabelsâ€ť to count, causing the issue. It would help if you replaced Labels with XML values. I am not sure, but it is probably like this â€śFully metâ€ť XML values might be â€śfully_metâ€ť, check the answers XML values and replace it.

Thanks @osmanburcu It is working now. Perhaps what if the number of questions are more than 50, is the procedure same? or do we have to write another coding?

I have never thought about more than 50 questions, but i believe it will be no change in the coding. If you face any problems later, we can help again

Here you go! 55 questions. I am sure there could be shorter way to calculate this.
if(\${aq1}=â€śfully_metâ€ť,1,0) + if(\${aq2}=â€śfully_metâ€ť,1,0) + if(\${aq3}=â€śfully_metâ€ť,1,0)+ if(\${aq4}=â€śfully_metâ€ť,1,0)+ if(\${aq5}=â€śfully_metâ€ť,1,0)+ if(\${bq1}=â€śfully_metâ€ť,1,0) + if(\${bq2}=â€śfully_metâ€ť,1,0) + if(\${bq3}=â€śfully_metâ€ť,1,0)+ if(\${bq4}=â€śfully_metâ€ť,1,0)+ if(\${cq1}=â€śfully_metâ€ť,1,0) + if(\${cq2}=â€śfully_metâ€ť,1,0) + if(\${cq3}=â€śfully_metâ€ť,1,0) + if(\${cq4}=â€śfully_metâ€ť,1,0) + if(\${cq5}=â€śfully_metâ€ť,1,0) + if(\${cq6}=â€śfully_metâ€ť,1,0) + if(\${cq7}=â€śfully_metâ€ť,1,0) + if(\${cq8}=â€śfully_metâ€ť,1,0) + if(\${cq9}=â€śfully_metâ€ť,1,0) + if(\${cq10}=â€śfully_metâ€ť,1,0) + if(\${cq11}=â€śfully_metâ€ť,1,0) + if(\${cq12}=â€śfully_metâ€ť,1,0) + if(\${cq13}=â€śfully_metâ€ť,1,0) + if(\${cq14}=â€śfully_metâ€ť,1,0) + if(\${dq1}=â€śfully_metâ€ť,1,0) + if(\${dq2}=â€śfully_metâ€ť,1,0) + if(\${dq3}=â€śfully_metâ€ť,1,0) + if(\${dq4}=â€śfully_metâ€ť,1,0) + if(\${dq5}=â€śfully_metâ€ť,1,0) + if(\${dq6}=â€śfully_metâ€ť,1,0) ) + if(\${eq1}=â€śfully_metâ€ť,1,0) + if(\${eq2}=â€śfully_metâ€ť,1,0) + if(\${eq3}=â€śfully_metâ€ť,1,0) + if(\${eq4}=â€śfully_metâ€ť,1,0) + if(\${eq5}=â€śfully_metâ€ť,1,0) + if(\${eq6}=â€śfully_metâ€ť,1,0) + if(\${3q7}=â€śfully_metâ€ť,1,0) + if(\${eq8}=â€śfully_metâ€ť,1,0) + if(\${eq9}=â€śfully_metâ€ť,1,0) + if(\${3q10}=â€śfully_metâ€ť,1,0) + if(\${eq11}=â€śfully_metâ€ť,1,0) + if(\${eq12}=â€śfully_metâ€ť,1,0) + if(\${eq13}=â€śfully_metâ€ť,1,0) + if(\${eq14}=â€śfully_metâ€ť,1,0) ) + if(\${eq15}=â€śfully_metâ€ť,1,0) + if(\${eq16}=â€śfully_metâ€ť,1,0) + if(\${fq1}=â€śfully_metâ€ť,1,0) + if(\${fq2}=â€śfully_metâ€ť,1,0) + if(\${fq3}=â€śfully_metâ€ť,1,0) + if(\${fq4}=â€śfully_metâ€ť,1,0) + if(\${fq5}=â€śfully_metâ€ť,1,0) + if(\${fq6}=â€śfully_metâ€ť,1,0) + if(\${gq1}=â€śfully_metâ€ť,1,0) + if(\${gq2}=â€śfully_metâ€ť,1,0) + if(\${gq3}=â€śfully_metâ€ť,1,0)