Best and worst in a group with MAXIFS and MINIFS

Summaries and rankings · About 6 minutes

Best and worst in a group with MAXIFS and MINIFS

MAXIFS finds the highest value among the rows that match a condition. MINIFS finds the lowest. They are written like SUMIFS: the numbers first, then where to look and what to look for.

=MAXIFS(D2:D8,B2:B8,"West") reads as "the highest sale in D2 to D8 where the region in B2 to B8 is West".

Add more pairs for more conditions: =MAXIFS(D2:D8,B2:B8,"East",C2:C8,"Jan"). Words go in quotes.

Part of Plus

Free during our founding launch: sign in to unlock this lesson's exercises, the timed practice sets and the rest of Plus. The free lessons stay free, with no account needed.

What MAXIFS and MINIFS does

MAXIFS finds the highest number among only the rows that pass your tests. MINIFS finds the lowest. For example: the best score in one team, or the earliest finish in one group.

Without them you'd filter the list and then use MAX or MIN by hand. With them the answer sits in one cell and updates as the data changes. Add more pairs of range and test to narrow it down further.

How to write MAXIFS and MINIFS

=MAXIFS(max_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)

max_range
The numbers to find the highest of. It comes first, as in SUMIFS.
criteria_range1
The cells to test, like the Team column.
criteria1
The test those cells must pass, like "Blue" or a cell holding the word.
criteria_range2, criteria2, ...
Optional. More pairs of range and test; a row must pass all of them.

=MINIFS(min_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)

min_range and the pairs
The same parts, but it finds the lowest number instead.

MAXIFS and MINIFS worked example

A swim club counts laps per swimmer. In C9, find the most laps swum by anyone on the team named in A9.

A swim club counts laps per swimmer. In C9, find the most laps swum by anyone on the team named in A9.
ABC
1NameTeamLaps
2AnaRed14
3BenBlue18
4CyRed20
5DevBlue11
6EvaRed17
7FinBlue16
8
9Blue18
C9=MAXIFS(C2:C7,B2:B7,A9)Look at the laps in C2:C7 on the rows where B2:B7 says Blue (18, 11 and 16) and take the highest. It shows 18.

Common MAXIFS and MINIFS mistakes

The answer is 0

No row passed the test, so MAXIFS and MINIFS show 0. Check the spelling and look for stray spaces in the data or the test.

An error as soon as you press Enter

Make the number range and every test range the same size, like C2:C7 and B2:B7.

#NAME? instead of an answer

The file is open in Excel 2016 or older, which doesn't have these functions. They work in Excel 2019 and later, Microsoft 365 and Google Sheets.

MAXIFS, MAX or LARGE?

Use MAX or MIN for the whole column, and MAXIFS or MINIFS when only some rows count. If you need the 2nd or 3rd highest rather than the top, use LARGE or SMALL.

MAXIFS gives the number, not who it belongs to. To bring back the name for that number, look it up with XLOOKUP or INDEX and MATCH.

Questions people ask

How do I find the max value with a condition?

=MAXIFS(D2:D8,B2:B8,"West") gives the highest value in D2:D8 where the region is West.

Can MAXIFS take more than one condition?

Yes. Add more pairs: =MAXIFS(D2:D8,B2:B8,"East",C2:C8,"Jan").

In which order do the parts go?

Like SUMIFS: the numbers first, then each place to look and what to look for.

Which versions have MAXIFS?

Excel 2019 and later (including 2021 and 2024), Microsoft 365, Excel for the web, and Google Sheets. Not Excel 2016 or older.

Theme