STDEVPA
Calculates standard deviation 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.
Syntax
expression.STDEVPA(args);
expression - A variable that represents a ApiWorksheetFunction class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| args | Required | number[] | number | string | boolean | ApiRange | ApiName | Up to 255 values for which the standard deviation will be calculated. The first argument is required, subsequent arguments are optional. Arguments can be numbers, logical values, text strings, names, ranges, or arrays. |
Returns
number
Example
Calculate the standard deviation of a population including logical values and text.
// The STDEVPA function treats text as 0 and logical values as 0 (false) or 1 (true) in population calculations.
// Get the population standard deviation including logical and text values, and place it in cell C1.
const worksheet = Api.GetActiveSheet();
let valueArr = [1, 0, 0, false, 5, 1, 0, 0, 2, true, 6, 7, 6, 8, 10, 12];
// Place the numbers in cells
for (let i = 0; i < valueArr.length; i++) {
worksheet.GetRange("A" + (i + 1)).SetValue(valueArr[i]);
}
let func = Api.WorksheetFunction;
let ans = func.STDEVPA(1, 0, 0, false, 5, 1, 0, 0, 2, true, 6, 7, 6, 8, 10, 12); //includes logical values
worksheet.GetRange("C1").SetValue(ans);