Skip to main content

MAX

Returns the largest value in a set of values. Ignores logical values and text.

Syntax

expression.MAX(args);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

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

Returns

number

Example

This example shows how to return the largest value in a set of values. Ignores logical values and text.

// How to get a maximum number from a list of numbers.

// Use a function to find a maximum from a list.

const worksheet = Api.GetActiveSheet();
let func = Api.GetWorksheetFunction();
let max = func.MAX(123, 197, 46, 354, 67, 456);
worksheet.GetRange("C1").SetValue(max);