How to Use the MAX Function in Google Sheets

Published on

There are several ways to find the maximum value in a range in Google Sheets, and the MAX function is one of them. Other methods include using SORTN or QUERY to sort the data in descending order and return the first value. Additionally, you can use the LARGE function. In this tutorial, we will focus on the MAX function, which is the simplest option.

Example:

=MAX(D1:E10)

This formula returns the maximum value in the range D1:E10.

Syntax:

MAX(value1, [value2, …])

Arguments:

  • value1: The first value, cell reference, array constant, or cell range to consider when calculating the maximum value.
  • value2: Optional. The second value, cell reference, array constant, or cell range to consider when calculating the maximum value.

Examples:

  • =MAX(50, 100) — where 50 is value1 and 100 is value2.
    Returns: 100
  • =MAX({100, 200, 50, 350}) — where {100, 200, 50, 350} is value1.
    Returns: 350
  • =MAX(A1:A) — where A1:A is value1.
    Returns: The maximum value in column A
  • =MAX(D1:D7, E1:E11) — where D1:D7 is value1 and E1:E7 is value2.
    Returns: The maximum value in the combined ranges D1:D7 and and E1:E11.

These examples demonstrate how to use the MAX function in Google Sheets.

Combining MAX with Other Functions for Advanced Analysis

The MAX function is commonly used with lookup functions such as XLOOKUP and FILTER.

For example, to find the item with the highest price in a list, you can combine XLOOKUP with MAX.

Assume column A contains item names and column B contains their prices.

You can use the following formula:

=XLOOKUP(MAX(B1:B), B1:B, A1:A)

In this formula, the MAX function acts as the search key. XLOOKUP searches for this key in column B and returns the corresponding value from column A.

Syntax:

XLOOKUP(search_key, lookup_range, result_range)

However, if there is more than one item with the same maximum value, you can use FILTER instead of XLOOKUP to return all matching items:

=FILTER(A1:A, B1:B=MAX(B1:B))

This FILTER function returns the values in column A that meet the condition B1:B=MAX(B1:B).

Syntax:

FILTER(range, condition1, [condition2, …])

Similarly, you can use the MAX function with other functions such as VLOOKUP, LOOKUP, HLOOKUP, MATCH, XMATCH, INDEX, etc.

For example, the following formula uses XMATCH to find the relative position of the maximum value in column B, and INDEX to return the corresponding value from column A:

=INDEX(A1:A, XMATCH(MAX(B:B), B:B))

Additional Tips

  • The MAX function includes values from hidden rows when the value1 argument is a range. To exclude hidden rows, consider using the SUBTOTAL function instead.
  • If the specified cell or range is empty, the MAX function will return 0. To return an empty cell instead of 0, use this formula:
    =LET(maximum, MAX(B1:B), IF(maximum=0,,maximum))
    Replace B1:B with the range where you want to find the maximum value.
  • According to the official documentation, the MAX function is specified to handle up to 30 arguments. However, Google Sheets supports an arbitrary number of arguments for this function.

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. With years of experience working with Google Sheets and Excel for multinational firms in Mumbai and Dubai, he has been blogging since 2012, offering practical, real-world spreadsheet solutions that professionals rely on. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Mode of Comma-Separated Numbers in Excel (Dynamic Array)

There is no dedicated function in Excel to directly find the mode of comma-separated...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

Count Consecutive Workday Absences in Google Sheets

This tutorial offers a powerful formula-based solution to count consecutive workday absences in Google...

More like this

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

Count Consecutive Workday Absences in Google Sheets

This tutorial offers a powerful formula-based solution to count consecutive workday absences in Google...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.