Statistical function

MAXIFS function

Returns the largest number among the rows that meet one or more conditions, e.g. the biggest sale in the North region.

Available in Microsoft 365, Excel 2019 and later, Excel for the web

Excel 2019 and laterWorks in Google Sheets

Syntax

MAXIFS(max_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)
ArgumentWhat it means
max_rangeRequiredThe cells containing the numbers to take the maximum from.
criteria_range1RequiredThe range to test against the first condition. Same size as max_range.
criteria1RequiredThe condition, e.g. "North", ">100", "<>"&F1 or a cell reference.
criteria_range2, criteria2, ...OptionalUp to 126 additional range/condition pairs. All must be true for a row to count.

Returns: The largest number in max_range among matching rows, or 0 if no row matches.

How MAXIFS works

MAXIFS works like SUMIFS and COUNTIFS, but instead of adding or counting, it returns the maximum of the matching rows. Ask for the biggest order from a given customer, the highest score in a class, the latest delivery date for a supplier, or the top sale of laptops in the North region. Every condition you add narrows the rows further (they are combined with AND).

Conditions use the same rules as the other *IFS functions: plain text for exact matches (not case-sensitive), operators inside quotes such as ">=1000", wildcards * and ?, and "<>" for non-empty. To compare with a cell, join the operator and the reference: ">="&H1. If no row matches, MAXIFS returns 0, not an error. MAXIFS appeared in Excel 2019; in older versions use an array formula such as =MAX(IF(B2:B7="North",D2:D7)).

Examples

1Largest sale in one region

F2fx=MAXIFS(D2:D7, B2:B7, "North")
ABCDEF
1RepRegionProductAmount
2AnaNorthLaptop12501420
3BenSouthPhone980
4ChloeNorthPhone1420
5DevNorthLaptop1100
6EvaSouthLaptop1675
7FinnWestPhone640

Result: 1420

Three rows are North (1,250, 1,420, 1,100). The largest is Chloe's 1,420.

2Two conditions: region and product

F2fx=MAXIFS(D2:D7, B2:B7, "North", C2:C7, "Laptop")
ABCDEF
1RepRegionProductAmount
2AnaNorthLaptop12501250
3BenSouthPhone980
4ChloeNorthPhone1420
5DevNorthLaptop1100
6EvaSouthLaptop1675
7FinnWestPhone640

Result: 1250

Only Ana's and Dev's rows are North laptop sales; the maximum is 1,250.

3Condition with a comparison operator

F2fx=MAXIFS(D2:D7, D2:D7, "<1500")
ABCDEF
1RepRegionProductAmount
2AnaNorthLaptop12501420
3BenSouthPhone980
4ChloeNorthPhone1420
5DevNorthLaptop1100
6EvaSouthLaptop1675
7FinnWestPhone640

Result: 1420

The criteria range can be the same as the max range. This returns the largest sale below 1,500, which is 1,420, useful for ignoring a known outlier or a cap.

4No match returns 0

F2fx=MAXIFS(D2:D7, B2:B7, "East")
ABCDEF
1RepRegionProductAmount
2AnaNorthLaptop12500
3BenSouthPhone980
4ChloeNorthPhone1420
5DevNorthLaptop1100
6EvaSouthLaptop1675
7FinnWestPhone640

Result: 0

No row is in the East region, so the result is 0. Wrap it like =IF(COUNTIFS(B2:B7,"East")=0, "none", MAXIFS(...)) if 0 could be mistaken for a real value.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 18 KB

Common errors and how to fix them

ErrorWhy it happensFix
#VALUE!max_range and a criteria_range have different sizes or shapes.Make every range the same number of rows and columns.
#NAME?The workbook is opened in Excel 2016 or older, which does not have MAXIFS.Use =MAX(IF(...)) entered with Ctrl+Shift+Enter, or AGGREGATE.
Result is 0No row met all conditions (often a typo or trailing space in the criteria).Check the criteria with COUNTIFS using the same conditions.

Tips

  • Put criteria in cells (=MAXIFS(D:D, B:B, H2)) so you can change the region without editing the formula.
  • For the latest date per customer, use MAXIFS on the date column and format the result as a date.
  • Wildcards work: "Lap*" matches Laptop and Lapdesk.

Questions

What if I need MAXIFS in Excel 2016?

Use =MAX(IF((B2:B7="North")*(C2:C7="Laptop"), D2:D7)) confirmed with Ctrl+Shift+Enter, or =AGGREGATE(14,6,D2:D7/((B2:B7="North")*(C2:C7="Laptop")),1).

Can MAXIFS use OR logic?

Not directly; each condition is AND. Take the larger of two MAXIFS: =MAX(MAXIFS(D:D,B:B,"North"), MAXIFS(D:D,B:B,"West")).

Why does MAXIFS return 0 when the data is negative?

If nothing matches it returns 0. If rows match and all are negative it returns the largest negative number; it never invents a 0 for matching rows.

Google Sheets

MAXIFS also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

MAXIFS in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
DanishMAKSHVISER
DutchMAX.ALS.VOORWAARDEN
FinnishMAKS.JOS.JOUKKO
FrenchMAX.SI.ENS
GermanMAXWENNS
HungarianMAXHA
ItalianMAX.PIÙ.SE
Norwegian (Bokmål)MAKS.HVIS.SETT
PolishMAKS.WARUNKÓW
Portuguese (Brazil)MÁXIMOSES
Portuguese (Portugal)MÁXIMO.SE.S
RussianМАКСЕСЛИ
SpanishMAX.SI.CONJUNTO
TurkishÇOKEĞERMAK