Calculation -disregard NA

  • harmonyautism
    Asked on October 27, 2020 at 4:44 PM

    Hello! I have a simple quiz that needs to calculate a total percentage at the end.

    Possible answers are "Yes", "No," and "N/A"

    How do I set up form calculations to not take into account into the total if the answer is "N/A"?

    For example,

    Question 1: Is the sky blue? Answer: Yes (correct)

    Question 2: Is a banana yellow? Answer: No (incorrect)

    Question 3: 1+1=2? Answer: Yes (correct)

    Question 4: How old is he? (he's dead) Answer: N/A (does not apply- not calculated)

    Total Score= 66%

    To clarify, how do I set this up so if Question 4 is correct/incorrect (not N/A), the answer IS taken into account?

  • KrisLei Jotform Support
    Replied on October 27, 2020 at 7:49 PM

    Hello,

    I have checked your form, and I can see that you have already assigned values for the Single Choice field options. It seems that you are on the right track. You don't have to assign any value for the N/A, so this will not be counted on the calculations.

    To clarify, how do I set this up so if Question 4 is correct/incorrect (not N/A), the answer IS taken into account?

    If the user switches the answer to Yes, this will be automatically counted on the Form Calculation widget. However, if NO will serve as an incorrect answer, I think you should assign a negative value to it, i.e., -1, so that this will be deducted from the user's score.

    I have cloned your form and add a form calculation widget to perform the calculations into a percentage:

    1603842475 5f98b1ab734e3 Screenshot 1028 Screenshot 10

    Then assign -1 for the No answer. You can check the results here: https://form.jotform.com/203007859785970

    Let us know if it didn't meet your requirements.

  • harmonyautism
    Replied on October 28, 2020 at 1:28 PM
    Thanks. The link you provided goes to a log in page. I enter my log in info
    and nothing happens. I tried a few hours ago and again now.
    Anyway, I tried the calculations you used as pictured in your email and
    something is not calculating correctly. I used the calculation for just the
    1st section (Prepared) of the form. If I answered "Yes" to 4 questions,
    "No" to 1 question, I'm getting a score of 50. I suck at math, but
    shouldn't that be 80%?
    https://hipaa.jotform.com/203006086888157
    ...
  • John Support Team Lead
    Replied on October 28, 2020 at 3:57 PM

    My colleague's form has been set as PRIVATE reason why you cannot view it. It is enabled now so you'll be able to view it.

    And going back to your concern, yes, it should be 80%. I just fiddled some tests on my form and here's I came up with:

    1.) Instead of 10, we will use 5 as the divisor since it is the total number of questions, right?

    2.) Then you said when N/A is selected, say only number 1 is N/A, the divisor should now be 4.

    3.) I would suggest adding a number field for each question and use conditions to prepopulate it with one every time an answer to its corresponding question is N/A, but first set YES=1, and NO and NA as 0 in the calculation values, then add the fields I mentioned:

    1603914505 5f99cb0980309  Screenshot 10


    1603914604 5f99cb6c11c10  Screenshot 21

    You can set these fields as hidden.

    4.) Next, add conditions that if NA is selected, assign a value of 1 to the corresponding NA number field. Here's the condition:

    1603914718 5f99cbde68f9a  Screenshot 32

    Do this for each question.

    5.) And then add another form calculation field to calculate the sum of all NA fields, I named it DIVISOR:

    1603914908 5f99cc9c257a2  Screenshot 43

    6.) Lastly, formulate the calculation in the FORM CALC field using this:

    1603915027 5f99cd1361bf8  Screenshot 54

    That should do the trick I guess. Here's my form: https://form.jotform.com/203016554197959


  • harmonyautism
    Replied on October 28, 2020 at 4:28 PM
    There must be a simpler way to do this. That's A LOT of clicking and i'll
    be adding many more questions. The issue is just the formula.Why was it
    adding up to 50 if ever question was answered Yes although there are only 5
    questions? I think you were on the right track with Yes=1, No= -1. Can you
    have someone else look at this and find a simpler solution?
    ...
  • harmonyautism
    Replied on October 28, 2020 at 9:28 PM
    It's been 5 hours since I sent this. When should I expect a response?
    ...
  • John Support Team Lead
    Replied on October 28, 2020 at 10:55 PM

    I tried looking for a different approach on how to achieve the requirement, but can't find any other workaround than what I have provided.

    The "Yes=1, No= -1" doesn't work on my end since it only applies to the DIVIDEND, whereas the requirement needs the DIVISOR to be adjusted.

    I have also conducted this with my colleague above to see if she has another idea, I'll send her a follow up and let you know here if she was able to come up with a solution.

  • KrisLei Jotform Support
    Replied on October 28, 2020 at 11:31 PM

    Hello @harmonyautism,

    My apologies for the late response.

    I have checked my demo form, and it seems that it's not pulling the right calculations by assigning a negative value on the options. My colleague's method seems to be the best approach to meet your requirements.

    He's right: "The "Yes=1, No= -1" doesn't work on my end since it only applies to the DIVIDEND, whereas the requirement needs the DIVISOR to be adjusted."

    Kindly give it a try and let us know if you need further assistance.

  • harmonyautism
    Replied on October 29, 2020 at 3:28 PM
    i can't see your formula in step 6 after "Divisor 0-9". the red box is
    covering up the formula
    ...
  • KrisLei Jotform Support
    Replied on October 29, 2020 at 4:50 PM

    Here's a screenshot for the calculations on step 6:

    1604004518 5f9b2aa6bf35b Screenshot 1030 Screenshot 10

    You may clone my colleague's form for your reference: https://form.jotform.com/203016554197959

    Guide: how-to-clone-an-existing-form-from-a-URL


  • harmonyautism
    Replied on October 29, 2020 at 5:28 PM
    Divisor field seems to work, the field (Prepared Score) is empty when I
    click on any of the answers.
    https://hipaa.jotform.com/build/203006086888157
    ...
  • KrisLei Jotform Support
    Replied on October 29, 2020 at 6:35 PM

    It seems that it has an excessive closing parenthesis, ')'. Can you try to eliminate it or add an opening parenthesis at the beginning of the formula?

    1604010935 5f9b43b7a8c89 Screenshot 1030 Screenshot 10

  • harmonyautism
    Replied on October 30, 2020 at 4:28 PM
    Now the total average score (bottom of page) is coming up with 900 when all
    answers are Yes. I used the "ave ( )" function.
    https://hipaa.jotform.com/build/203006086888157
    ...
  • John Support Team Lead
    Replied on October 30, 2020 at 5:46 PM

    I can see you used "+" plus signs in the widget. Replace those with comma:

    1604094380 5f9c89ac344be  Screenshot 10This should work as intended. Here's a cloned form: https://form.jotform.com/203037013229948