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], ...)| Argument | What it means | |
|---|---|---|
max_range | Required | The cells containing the numbers to take the maximum from. |
criteria_range1 | Required | The range to test against the first condition. Same size as max_range. |
criteria1 | Required | The condition, e.g. "North", ">100", "<>"&F1 or a cell reference. |
criteria_range2, criteria2, ... | Optional | Up 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
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Rep | Region | Product | Amount | ||
| 2 | Ana | North | Laptop | 1250 | 1420 | |
| 3 | Ben | South | Phone | 980 | ||
| 4 | Chloe | North | Phone | 1420 | ||
| 5 | Dev | North | Laptop | 1100 | ||
| 6 | Eva | South | Laptop | 1675 | ||
| 7 | Finn | West | Phone | 640 |
Result: 1420
Three rows are North (1,250, 1,420, 1,100). The largest is Chloe's 1,420.
2Two conditions: region and product
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Rep | Region | Product | Amount | ||
| 2 | Ana | North | Laptop | 1250 | 1250 | |
| 3 | Ben | South | Phone | 980 | ||
| 4 | Chloe | North | Phone | 1420 | ||
| 5 | Dev | North | Laptop | 1100 | ||
| 6 | Eva | South | Laptop | 1675 | ||
| 7 | Finn | West | Phone | 640 |
Result: 1250
Only Ana's and Dev's rows are North laptop sales; the maximum is 1,250.
3Condition with a comparison operator
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Rep | Region | Product | Amount | ||
| 2 | Ana | North | Laptop | 1250 | 1420 | |
| 3 | Ben | South | Phone | 980 | ||
| 4 | Chloe | North | Phone | 1420 | ||
| 5 | Dev | North | Laptop | 1100 | ||
| 6 | Eva | South | Laptop | 1675 | ||
| 7 | Finn | West | Phone | 640 |
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
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Rep | Region | Product | Amount | ||
| 2 | Ana | North | Laptop | 1250 | 0 | |
| 3 | Ben | South | Phone | 980 | ||
| 4 | Chloe | North | Phone | 1420 | ||
| 5 | Dev | North | Laptop | 1100 | ||
| 6 | Eva | South | Laptop | 1675 | ||
| 7 | Finn | West | Phone | 640 |
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.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#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 0 | No 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.
| Language | Function name |
|---|---|
| Danish | MAKSHVISER |
| Dutch | MAX.ALS.VOORWAARDEN |
| Finnish | MAKS.JOS.JOUKKO |
| French | MAX.SI.ENS |
| German | MAXWENNS |
| Hungarian | MAXHA |
| Italian | MAX.PIÙ.SE |
| Norwegian (Bokmål) | MAKS.HVIS.SETT |
| Polish | MAKS.WARUNKÓW |
| Portuguese (Brazil) | MÁXIMOSES |
| Portuguese (Portugal) | MÁXIMO.SE.S |
| Russian | МАКСЕСЛИ |
| Spanish | MAX.SI.CONJUNTO |
| Turkish | ÇOKEĞERMAK |