TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

AVERAGE

AVERAGE(args) → { number }

Returns the average (arithmetic mean) of the specified arguments.

Parameters:

Name Type Description
args number | string | Array.<number>

Up to 255 numeric values for which the average value will be returned. The first argument is required, subsequent arguments are optional. Arguments can be numbers or names, arrays or references that contain numbers.

Returns:

Type
number

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
var ans = oFunction.AVERAGE(123, 197, 46, 345, 67, 456);
oWorksheet.GetRange("B2").SetValue(ans);
builder.SaveFile("xlsx", "AVERAGE.xlsx");
builder.CloseFile();

Resulting document