# 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)