top of page
41. Calculate the Average of Answered Variables
Description
Takes the average of only ANSWERED variables.
Code
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
Explanation
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.
bottom of page