Skip to main content

STDEV

Estimates standard deviation based on a sample (ignores logical values and text in the sample).

Syntax​

expression.STDEV(args);

expression - A variable that represents an ApiWorksheetFunction class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
argsRequirednumber[] | number | ApiName | ApiRangeUp to 255 numeric values for which the standard deviation will be calculated. The first argument is required, subsequent arguments are optional. Arguments can be numbers, names, ranges, or arrays of numbers.

Returns​

number

Example​

Estimate the standard deviation of a sample using the STDEV compatibility function in a spreadsheet.

// The STDEV function calculates sample standard deviation while ignoring logical values and text.

// Get the standard deviation of the sample values and place it in cell C1.

const worksheet = Api.GetActiveSheet();

let valueArr = [3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 13, 14];

for (let i = 0; i < valueArr.length; i++) {
worksheet.GetRange("A" + (i + 1)).SetValue(valueArr[i]);
}

let func = Api.WorksheetFunction;
let ans = func.STDEV(3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 13, 14);

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