Skip to main content

VAR_P

Calculates variance based on the entire population (ignores logical values and text in the population).

Syntax​

expression.VAR_P(args);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
argsRequirednumber | ApiName | ApiRange | number[]Up to 255 numeric values for which the variance 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​

Calculate variance based on the entire population (ignores logical values and text in the population) in a spreadsheet.

// The VAR_P function computes population variance from numeric data only.

// Apply the function to calculate variance based on the entire population in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
let result = func.VAR_P(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
worksheet.GetRange("B2").SetValue(result);