0 IF ANSWERED( NumVar1 ) RESULT + 1 END IF IF ANSWERED( NumVar2 ) RESULT + 1 END IF IF ANSWERED( NumVar3 ) RESULT + 1 END IF ( ZERO( NumVar1 ) + ZERO( NumVar2 ) + ZERO( NumVar3 ) ) / RESULT
The computation adds the number of answered variables in RESULT. This will be the divisor. It then sums all of the potentially answered variables and divides them by the number of actually answered variables. The average of the answered variables is returned.