I'm trying to find a script that will calculate the average (mean) of user-entered data, the user may enter anywhere between 1 and 6 number values. This is what I've tried in FormCalc:
var dcount=1;
if Row3.Cell6 !=null then (dcount=dcount+1);
if Row4.Cell6 !=null then (dcount=dcount+1);
if Row5.Cell6 !=null then (dcount=dcount+1);
if Row6.Cell6 !=null then (dcount=dcount+1);
if Row7.Cell6 !=null then (dcount=dcount+1);
(Row2.Cell6 + Row3.Cell6 + Row4.Cell6 + Row5.Cell6 + Row6.Cell6 + Row7.Cell6) / dcount
I've also tried
if HasValue (Row3.Cell6) then (dcount=dcount+1);
etc.
But I get syntax errors in both cases. How can I fix the script so that this does what I need it to?