The function MAX returns the largest Number from within a List of Numbers, or from some number of individual Number values.
This function takes input in two forms: it will accept either a List of Numbers, or an arbitrary number of individual Number values. It will return a single Number: the largest of the Numbers given (either within the list or individually).
Declaration
MAX(list_of_numbers) -> max_of_numbers
MAX(number_1, number_2, ... number_n) -> max_of_numbers
Parameters
list_of_numbers (type: List
of Numbers
)
A list of Numbers. There is no limit to the number of items that can be in this list.
number_n (type: Number
)
The nth individual Number given as input. n can be arbitrarily large; there is no upper limit to the number of Numbers MAX will accept.
Return Values
max_of_numbers (type: Number
)
The largest of the given numbers.
Examples
The following example takes the individual Numbers 1, 2, and 3 as input and returns the largest of the three:
MAX(1, 2, 3) -> 3
The following example takes the List of Numbers [1, 2, 3] and returns the largest Number of the three in the List. Note that the output is identical to the example above.
MAX([1, 2, 3]) -> 3
While the MAX function accepts input in the form of either a List of Numbers or some individual Number values, it cannot parse a combination of the two. The following example demonstrates how the MAX function will behave if given both a List and an individual Number – namely, that it returns NULL:
MAX([1, 2], 3) -> NULL