Skip to main content

max

Returns the cell(s) containing the maximum value in a table region of numbers.

Use max to find all cells containing the maximum value. The function returns the cells along with the associated row names, which you can then interrogate with another function. See the examples for guidance.

DO NOT use this function to get the maximum value — for that, use maxVal instead.

Note

Available in "Describe the Table" and "Describe Row in Context" projects only.

Parameters

  • REGION (table region)

    The table region to search.

Notes

  • Typically, the input is a column variable, but you can enter a larger region if required.

  • All values in the region must be numbers.

Examples

Assume a "Describe the Table" project with this data:

Branch

Orders

salesRev

COGS

otherRev

otherExp

netProfit

Row 1

Aberdeen

15

14,000

8,000

2,000

1,500

6,500

Row 2

Edinburgh

35

33,000

19,000

2,000

3,500

12,500

Row 3

Inverness

18

16,000

8,250

1,200

1,500

7,450

Row 4

Glasgow

35

32,500

17,750

1,250

1,700

14,300

Row 5

Dundee

16

15,750

7,500

1,250

1,200

8,300

Row 6

Perth

15

14,500

8,000

1,000

1,400

6,100

The max function is rarely (if ever) used in isolation. Typically, it's combined with rowNames.

ATL in Script

Result

[[rowNames(max(salesRev))]] has the highest sales total.

Edinburgh has the highest sales total.

[[rowNames(max(netProfit))]] is the most profitable branch.

Glasgow is the most profitable branch.

Note

In a "Describe Row in Context" project, the column variables are salesRevColumn and netProfitColumn, etc.

Note that max returns all cells containing the maximum value.

ATL in Script

Result

[[rowNames(max(Orders))]] received the most orders.

Glasgow and Edinburgh received the most orders.

IMPORTANT

To get the maximum value itself — not all cells containing that value — use maxVal instead.

ATL in Script

Result

The highest number of orders is [[maxVal(Orders)]].

The highest number of orders is 35.