Skip to main content

STDEV_S

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

Syntax

expression.STDEV_S(args);

expression - A variable that represents a 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.

// The STDEV_S 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];

// 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.STDEV_S(3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 13, 14); //ignores logical values and text

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