# Average Results with N/A answers using expressions and assesments

10 Monate 1 Woche her - 10 Monate 1 Woche her #161310 von maxHal
maxHal erstellte das Thema Average Results with N/A answers using expressions and assesments
Hi! I have had a good luck around and found a few threads that begin to explore this. But nothing that seems clear to my beginners level of knowledge. I hope readers will forgive my newbie ignorance.

I have a number of groups of questions (varying number of questions per group) but all questions are 'List with Comment' type (drop down presentation).

All questions have the same answers (1-5) and I have assigned assessment values to them.

A1 100 Gold
A2 66 Silver
A3 33 Bronze
A4 0 Fail
A5 0 N/A

For each group I have added an expression. And I can average the group, no problem. If I hard code the number group questions.

Where there are 4 questions in the group...
`{sum(q1.value,q2.value,q3.value,q4.value) / 4}`

(which gives me a percentage)

But obviously this doesn't give a correct average if a user selects answer 5 for 1 or more questions.

I know I need to return the number of group questions (count?) but I am unsure how to do this How do I achieve this?

Thanks.

Max
Letzte Änderung: 10 Monate 1 Woche her von maxHal.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

10 Monate 1 Woche her #161319 von tpartner
tpartner antwortete auf das Thema: Average Results with N/A answers using expressions and assesments
Try this:

`{sum(q1.value,q2.value,q3.value,q4.value) / sum(if (q1 == 'A5', 0, 1), if (q2 == 'A5', 0, 1), if (q3 == 'A5', 0, 1), if (q4 == 'A5', 0, 1))}`

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Folgende Benutzer bedankten sich: maxHal

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

10 Monate 1 Woche her #161322 von maxHal
maxHal antwortete auf das Thema: Average Results with N/A answers using expressions and assesments
Thanks! The 'if's' worked out perfectly.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.