I need to calculate a sum of points based on a 12x5 matrix question and 3 single choice questions.
The problem is that I can't use assessments, because each subquestion of the matrix question get different assessments on the different answers. So the equation is horribly long for that single question already, so I was wondering if I can create variables to keep the calculation clean instead of creating a huge amount of nested if statements.
I couldn't find anything in the manual, no example of this. So I guess it is not possible. But I thought I'd ask, maybe someone has a good solution.
My previous version looks like this:
Code:
{sum(CCEB1_1,CCEB1_2,if(CCEB1_3 == 1,4, if(CCEB1_3 == 2,5, if(CCEB1_3 == 3,6, if(CCEB1_3 == 4,7,0)))),if(CCEB1_4 == 1,4, if(CCEB1_4 == 2,7, if(CCEB1_4 == 3,9, if(CCEB1_4 == 4,9,0)))), if(CCEB1_5 == 1,3, if(CCEB1_5 == 2,4, if(CCEB1_5 == 3,4, if(CCEB1_5 == 4,4,0)))), if(CCEB1_6 == 1,2, if(CCEB1_6 == 2,2, if(CCEB1_6 == 3,2, if(CCEB1_6 == 4,2,0)))), if(CCEB1_7 == 1,2, if(CCEB1_7 == 2,2, if(CCEB1_7 == 3,2, if(CCEB1_7 == 4,2,0)))), if(CCEB1_8 == 1,4, if(CCEB1_8 == 2,4, if(CCEB1_8 == 3,4, if(CCEB1_8 == 4,4,0)))), if(CCEB1_9 == 1,2, if(CCEB1_9 == 2,2, if(CCEB1_9 == 3,2, if(CCEB1_9 == 4,2,0)))),CCEB2)}
Now it had become worse, because in the example above, for some of the subquestions above I could use the answer code as points, for others I had to apply different values via if loops. And then in this previous version there was only one additional single choice question, wherre I also could use the answer code as points.
Now all subquestions require their own if loops to attribute the points and I also need some if loops for the single choice questions and I feel the code written in one big piece is becoming a little big and complicated.
My other solution would be to write each question in a separte equation and then add them up in another equation. But I would find it cleaner to be able to break things up in only one equation question.