average, or sum of all values in an array
Please add ability to get the average, or sum of all values in an array (without having to do it manually with for loops)
Please add ability to get the average, or sum of all values in an array (without having to do it manually with for loops)
1. Array Set
%arr = 1,2,3
2. Array Join
%arr join by
+
3. Variable Set
%sum set to
%arr
Do maths (ticked)
4. Variable Set
%mean set to
(%arr) / %arr(#)
Do maths (ticked)
Even easier with the latest Tasker version :)
Test Math (155)
A1: Array Set [ Variable Array:%numbers Values:1,2,3,4,5 Splitter:, ]
A2: Variable Set [ Name:%result To:(%numbers(++))/%numbers(#) Recurse Variables:Off Do Maths:On Append:Off Max Rounding Digits:3 Structure Output (JSON, etc):On ]
A3: Flash [ Text:%result Long:Off ]