VARPA
function VARPA(args: number | string | boolean | ApiRange | number[] = null): number
Description
Calculates variance based on the entire population, including logical values and text. Text and the false logical value have the value 0; the true logical value has the value 1.
Parameters
Up to 255 values for which the variance will be calculated. The first argument is required, subsequent arguments are optional.
Returns
number
Try It
var oWorksheet = Api.GetActiveSheet();
// Data array
var data = [
[1, 0, 0, false],
["text", 1, 0, 0],
[2, 3, true, 7],
[6, 8, 10, 12]
];
// Place the data in cells A1:D4
for (var i = 0; i < data.length; i++) {
for (var j = 0; j < data[i].length; j++) {
oWorksheet.GetRangeByNumber(i, j).SetValue(data[i][j]);
}
}
// Calculate the VARPA of the range A1:D4 and place the result in cell D5
var oFunction = Api.GetWorksheetFunction();
var varpaResult = oFunction.VARPA(oWorksheet.GetRange("A1:D4"));
oWorksheet.GetRange("D5").SetValue(varpaResult);