Skip to main content

VAR

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

Syntax

expression.VAR(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

Estimate variance based on a sample (ignores logical values and text in the sample) in a spreadsheet.

// How to estimate variance based on a sample in a spreadsheet.

// Use a function to estimate variance ignoring logical and text values in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
let result = func.VAR(1, 4, 2, 6, 0, 1, 3, 8, 0, 0, 6, 10, 0, 0, 7, 12)
worksheet.GetRange("B2").SetValue(result);