Excel MAX Function

The Excel MAX function returns the largest value from a specified range of numeric values

Example: Excel MAX Function

Excel MAX Function

METHOD 1. Excel MAX Function

EXCEL

=MAX(C5:C9)
Result in cell C10 (15) - returns the largest numeric value from the selected range.

=MAX(D5:D9)
Result in cell D10 (42) - returns the largest numeric value from the selected range.

METHOD 2. Excel MAX function using the Excel built-in function library

EXCEL

Formulas tab > Function Library group > More Functions > Statistical > MAX > populate the input box

=MAX(C5:C9)
Note: in this example we are populating an input box with a single range.
Built-in Excel MAX Function

METHOD 1. Excel MAX function using VBA

VBA

Sub Excel_MAX_Function()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("MAX")
'apply the Excel MAX function
ws.Range("C10") = Application.WorksheetFunction.Max(ws.Range("C5:C9"))
ws.Range("D10") = Application.WorksheetFunction.Max(ws.Range("D5:D9"))

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named MAX.

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell references ("C10") and ("D10") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.

Usage of the Excel MAX function and formula syntax

EXPLANATION

DESCRIPTION
The Excel MAX function returns the largest value from a specified range of numeric values.
SYNTAX
=MAX(number1, [number2], ...)
ARGUMENTS
number1: (Required) A single numeric cell or a range of numeric cells.
number2: (Optional) A single numeric cell or a range of numeric cells.

ADDITIONAL NOTES
Note 1: In Excel 2007 and later the MAX function can accept up to 255 number arguments. In Excel 2003 the MAX function can only accept up to 30 number arguments.