TRIMMEAN
function TRIMMEAN(arg1: ApiRange | number[] = null, arg2: number = null): number
Description
Returns the mean of the interior portion of a set of data values.
Parameters
The range or array of values to trim and average.
- arg2
number
null The fractional number of data points to exclude from the top and bottom of the data set.
Returns
number
Try It
var oWorksheet = Api.GetActiveSheet();
var argumentsArr = [1, 2, 3, 4];
// Place the numbers in cells
for (var i = 0; i < argumentsArr.length; i++) {
oWorksheet.GetRange("A" + (i + 1)).SetValue(argumentsArr[i]);
}
// Get values from the range
var data = oWorksheet.GetRange("A1:A4");
// Calculate the TRIMMEAN of the range A1:A6
var oFunction = Api.GetWorksheetFunction();
var result = oFunction.TRIMMEAN(data, 0.6);
oWorksheet.GetRange("B1").SetValue(result);