Calculating a score from question answers (yes, no or n/a)

I have a form with numerous questions. All of the questions have yes or no type answers but some of them are not applicable and the user should be able to identify them as such. I am currently using a option field with 3 values, 1, 0, -1 for the questions with n/a as a valid choice, but Iam having problems getting the logic to sum up the results properly. For example, there are 10 questions, I need to know how many were identified as n/a, subtract this from the total, and then determine how many of the applicable questions were answered yes and how many were answered no. in the end, I want to calculate the percentage of yes, no and n/a answers, Any suggestions on how to write the expression to do this would be greatly appreciated.

Hi Ferdinand,

You can calculate the percentage of questions with a specific answer choice by using a few hidden values to first sum the number of questions with the responses 'yes' and 'no' and then using these totals to calculate the percentage.

For example, if you have 5 questions with the answer options 'yes,' 'no,' and 'n/a' you can use if statements to calculate the number of questions with each response:

  • Number of 'yes' answers (num_yes): if(question_1 = "yes", 1, 0) + if(question_2 = "yes", 1, 0) + if(question_3 = "yes", 1, 0) + if(question_4 = "yes", 1, 0) + if(question_5 = "yes", 1, 0)
  • Number of 'no' answers (num_no): if(question_1 = "no", 1, 0) + if(question_2 = "no", 1, 0) + if(question_3 = "no", 1, 0) + if(question_4 = "no", 1, 0) + if(question_5 = "no", 1, 0)

Then to calculate the percent of responses that are 'yes' you can divide num_yes by the sum of num_yes and num_no (the total number of applicable answers), and multiply by 100. This calculation would look like:

  • score_percentage = (num_yes div (num_yes + num_no)) * 100

You can use this example with other permutations to calculate the percentage of 'no' responses or any other answer choices.

Hope this helps,
Kaley

Thanks, Kaley for your help.