Quick, clean, and to the point

Maximum value if

Excel formula: Maximum value if
Generic formula 

To get a maximum value based on criteria, you can use the MAX function together with the IF function in an array formula. In the example shown, the formula in cell G6 is:


Where names is the named range B6:B17, and times is the named range D6:D17.

Notes: this is an array formula and must be entered with Control + Shift + Enter. Later versions of Excel have a MAXIFS function, see note below.

How this formula works

The IF function is evaluated first. The logical test names=F6 returns an array of TRUE / FALSE values, where TRUE values correspond to rows where the name matches "Hannah" in F6. The "value if true" for IF is the named range "times", which returns the full set of times. No "value if false" is provided, so the result of IF is an array that contains a time (where the logical test returned TRUE) and FALSE where it didn't.

The MAX function then returns the maximum value in this array. FALSE values are automatically ignored.


The MAXIFS function, introduced in Excel 2016 via Office 365 subscription, is designed to calculate maximums based on one or more criteria without the need for an array formula. With MAXIFS, the formula in G6 is:

Dave Bruns

Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.