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
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| args | Required | number | number[] | ApiRange | ApiName | Up 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
Find the largest number in a set of values in a spreadsheet.
// How do I identify the highest sales amount from a list of quarterly results in a spreadsheet?
// Get the maximum value from a collection of numbers in a spreadsheet.
const worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
let max = func.MAX(123, 197, 46, 354, 67, 456);
worksheet.GetRange("C1").SetValue(max);