跳到主要内容

STDEVA

Estimates standard deviation based on a sample, 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.STDEVA(args);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
argsRequirednumber[] | number | string | boolean | ApiRange | ApiNameUp 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

This example shows how to estimate standard deviation based on a sample, including logical values and text. Text and the false logical value have the value 0; the true logical value has the value 1.

// How to estimate standard deviation based on a sample considering logical and text data types.

// Use a function to get the standard deviation.

const worksheet = Api.GetActiveSheet();

let valueArr = [1, 0, 0, 0, "text", 1, 0, 0, 2, 3, true, false, 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.GetWorksheetFunction();
let ans = func.STDEVA(
1,
0,
0,
0,
"text",
1,
0,
0,
2,
3,
true,
false,
6,
8,
10,
12
); //includes logical values

worksheet.GetRange("C1").SetValue(ans);