How to Use Excel’s MAX Function (6 Examples)

Overview of using MAX function in Excel


Introduction to MAX Function in Excel

The MAX Function is categorized under Excel STATISTICAL functions. This function returns the largest value in a given list of arguments.

⦿ Syntax

Syntax - Excel MAX function

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

MAX (number1, [number2], ...)

⦿ Arguments

Argument Required/Optional Value
number1 Required reference to a numeric value or range that contains numeric values.
[number2] Optional Additional numbers, cell references, or ranges of numeric values.

You can provide up to a maximum of 255 arguments.


Example 1 – Finding the Maximum Value in a Row

Suppose you have a data table of students with their scores in three quizzes. To find the highest score for each student, insert the formula:

=MAX(C5:E5)
Sample Dataset of MAX Function

Here, C5:E5 represents the cell reference for the first row.

Formula of MAX Function for rows

Our formula has provided the highest score for Angela on the quizzes.

Output of MAX Function for Rows

  • Drag the Fill Handle to get maximum values for other rows.

Autofill to fill column with MAX Function


Example 2 – Finding the Maximum Value in a Column

If you want to find the highest score for each quiz (stored in three columns), insert:

=MAX(C5:C10)

Sample Dataset of MAX Function for Columns

 

Formula of MAX for Columns

  • We have found the highest score for Quiz 1. Drag the Fill Handle to the right to find the largest value for other columns.

Output of MAX Function for Columns

Read More: How to Find Max Value in Range with Excel Formula


Example 3 – Getting the Highest Value for Entire Data

To find the maximum value from an entire dataset (e.g., prices of items in different shops), insert:

=MAX(C5:E10)

Sample Dataset of MAX Function for Entire Data

Formula of MAX for Entire Data

We have found the maximum value in our table.

Output using MAX Function for Entire Data


Example 4 – Using MAX Function for Non-Adjacent Columns

Suppose you want to find the maximum value from non-adjacent columns (e.g., Shop1 and Shop3). Insert:

=MAX(C5:C10,E5:E10)

 

Sample Dataset of Non-adjacent Columns

Formula of MAX for Non-Adjacent Columns

Here we have set the column references separated by a comma (,). The formula provided the maximum value for the two non-adjacent columns.

Output for Non-Adjacent Columns


Example 5 – Finding the Most Recent Date

If you have a dataset with delivery dates, use the MAX function to find the most recent date:

Sample Dataset to Determine Recent Date using MAX Function

 

=MAX(D5:D10)

Formula of MAX to Determine Recent Date

Excel stores dates as sequential serial numbers, with 1 January 1900 as the 1st date (serial number 1).

The MAX function converts the dates into their respective serial numbers and finds the most recent date. Thus, the formula returned the most recent date.

Output using MAX to Determine Recent Date


Example 6 – Performing MAX Function with Criteria

Let’s say you have a dataset of sports items and their quantities.

Sample Dataset for using MAX function with Criteria

Set a criterion (e.g., Cricket Bats in cell G5) and insert the formula:

=MAX(IF(C5:C13=G5,D5:D13))

We need to set the condition using the IF function.

Sample Dataset for using MAX function with Criteria

This array formula checks if the criteria match and triggers the MAX operation.

Combination of MAX and IF functions to provide multiple criteria

 

Output of MAX Function with Criteria

Here we have found the highest quantity of Cricket Balls. If we change the criteria item, the result will be adjusted.

Output Changes if the Criteria is changes

Note: Remember, if you’re using an older version of Excel, press CTRL+SHIFT+ENTER to execute array formulas.

Read More: How to Find Maximum Value in Excel with Condition


How to Find Maximum Value with Excel VBA

  • Enabling the Developer Tab in Excel:
    • If you haven’t already enabled the Developer tab, right-click on any blank area of the Ribbon.
    • Select Customize the Ribbon.

Customizing Ribbon to enable Developer tab

    • In the Excel Options dialog box, check the box next to Developer and click OK. The Developer tab will now appear in your ribbon.

Enabling Developer tab in Excel

  • Using VBA Code to Find the Maximum Value:
    • Go to the Developer tab and click on Visual Basic.

Using Visual basic option

    • In the Microsoft Visual Basic for Applications window, go to the Insert tab and select Module from the drop-down.

Creating new Module

  • Enter the following VBA code in the newly created module:
Sub maxvalue()

Dim maxVal As Variant
Set inputRng = Selection
maxVal = WorksheetFunction.Max(inputRng)
Range("C12").Value = maxVal

End Sub
    • Click the Save icon and use the keyboard shortcut ALT + F11 to return to the worksheet.

Writing and Saving VBA code

  • Running the Macro:
    • Select the range of data for which you want to find the maximum value.
    • Go to the Developer tab and click on Macros.
    • Choose the maxvalue option in the Macro dialog box and click Run.

Using created Macro

  • The maximum value will appear in cell C12.

Maximum value found by using VBA Max function


Quick Notes

  • You can set the Cell References separated by a comma (,). We have inserted 3 cells in the function, and these are separated by a comma.

Output after applying MAX function

  • You can insert the numbers directly into the function to find the highest value.

Output of MAX Function with Cell Reference and Numbers

  • Numbers can be combined with ranges using a comma (,).

Output after putting Cell Range and Number inside the MAX Function

  • You can directly input the numbers into the function to get the largest value among them.

Output with Largest value using the MAX function

  • The MAX function ignores text or Boolean values and focuses on numeric values.

Output with Largest Numeric Values while ignoring Texts


Download Practice Workbook

You can download the practice workbook from here:


Excel MAX Function: Knowledge Hub


<< Go Back to Excel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Shakil Ahmed
Shakil Ahmed

My name’s Shakil. My articles are targeted to support you in enriching knowledge regarding different features related to Microsoft Excel. I am fond of literature, hope some knowledge from them will help me providing you some engaging articles even though some weary technical terms.

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo