I think as your case is very specific for your needs, I don't think that there is one example to do so.
Here an example that I use with various questions (one is a matrix question).
Mine is a little bit more complicated. What I do is to check the Matrix question and the response. For some of the subquestions I can use directly the value of the answer, for others I need to administer different points. Not sure if this helps or confuses more:
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)