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?
Solved! Go to Solution.
Views
Replies
Total Likes
Avg(Row3.Cell6,Row4.Cell6,Row5.Cell6,Row6.Cell6,Row7.Cell6)
Hint: If you name your rows the same (ex RowA) you can just put: Avg(RowA[*].Cell6) as your code
Kyle
Views
Replies
Total Likes
Avg(Row3.Cell6,Row4.Cell6,Row5.Cell6,Row6.Cell6,Row7.Cell6)
Hint: If you name your rows the same (ex RowA) you can just put: Avg(RowA[*].Cell6) as your code
Kyle
Views
Replies
Total Likes
Perfect yes, I figured this out on my own JUST as you posted your reply, thanks!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies