Excel MAX with Multiple Criteria: 3 Formulas

Formulas & functions · Updated November 23, 2026

To find the maximum value in Excel based on multiple criteria, use the MAXIFS function (Excel 2019 and later). For example, =MAXIFS(D2:D100, A2:A100, "North", B2:B100, "Widgets") returns the largest sales figure in D2:D100 where column A is “North” and column B is “Widgets”. If you are on an older version, use an array formula with MAX and IF, or a SUMPRODUCT alternative.

Why MAXIFS Is the Simplest Solution

Introduced in Excel 2019 and available in Microsoft 365, MAXIFS is the dedicated function for this task. Its syntax is:

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

You can add up to 126 pairs of criteria ranges and conditions. The function evaluates all conditions simultaneously, so a row is only considered if every criterion is true. It ignores text and blank cells in the max range automatically.

For example, with a table where A2:A20 holds regions, B2:B20 holds product types, and C2:C20 holds sales amounts, this formula returns the highest sales for “East” region and “Gadget” product:

=MAXIFS(C2:C20, A2:A20, "East", B2:B20, "Gadget")

If no rows match, MAXIFS returns 0. That is a common gotcha—you may want to wrap it in an IF to show a blank instead: =IF(COUNTIFS(A2:A20,"East",B2:B20,"Gadget")=0,"",MAXIFS(...)).

Using MAX with IF for Older Excel Versions

If you are using Excel 2016 or earlier, MAXIFS does not exist. The classic approach is an array formula:

=MAX(IF(A2:A20="East", IF(B2:B20="Gadget", C2:C20)))

This must be entered with Ctrl+Shift+Enter in older versions, which wraps it in curly braces { }. In Excel 365 and 2021, you can press Enter normally because dynamic arrays handle it. The formula works by testing each cell in A2:A20 against “East”, then for those that match, testing B2:B20, and finally returning the corresponding C2:C20 values. MAX then ignores the FALSE values.

Be careful: if no rows match, the IF returns FALSE, and MAX of a set containing FALSE is 0. To avoid that, use =IFERROR(MAX(IF(...)),"") or add a condition that counts matches first.

SUMPRODUCT Alternative for Compatibility

Another formula that works in all Excel versions without array entry is:

=SUMPRODUCT(MAX((A2:A20="East")*(B2:B20="Gadget")*C2:C20))

Here, the comparisons produce TRUE/FALSE arrays, multiplying them by the sales values yields the sales for matching rows and 0 for non-matching rows. MAX then returns the largest of those numbers. This is not an array formula, so you can press Enter normally. However, it has the same flaw: if no rows match, it returns 0, not an error. Also, it only works if the max range contains numbers—text values would cause a #VALUE! error.

Handling Numeric and Text Criteria

Criteria can be numbers, text, or expressions. For numeric comparisons, use quotes around operators: ">100", ">=50". For text, use exact match by default, or wildcards: "*Widget*" matches any text containing “Widget”. Case is ignored for text criteria.

If your criteria are in cells, reference them directly: =MAXIFS(C2:C20, A2:A20, E1, B2:B20, F1) where E1 and F1 hold the values. This makes the formula easy to update.

For dates, treat them as numbers. Enter the date in a cell and reference it, or use DATE(2025,1,1) inside the formula.

Common Errors and How to Fix Them

  • #VALUE! error – Often occurs in SUMPRODUCT when the ranges have different sizes. Ensure all ranges have the same number of rows and columns.
  • #NAME? error – Your Excel version does not support MAXIFS. Use the IF array formula or SUMPRODUCT.
  • Returns 0 when no match – This is by design. Wrap with IF and COUNTIFS to display a blank or custom message.
  • Wrong results with blank cells – MAXIFS ignores blanks in the max range, but IF and SUMPRODUCT treat blanks as 0. If you have blank cells in the max range and use the older formulas, consider using MAX(IF((A2:A20="East")*(B2:B20="Gadget")*(C2:C20<>""),C2:C20)).
  • Array formula not updating – If you edit an array formula and press Enter without Ctrl+Shift+Enter, it may break. Always use the proper entry method for your version.

Comparing MAXIFS, IF Array, and SUMPRODUCT

Method Version Entry Handles blanks Speed
MAXIFS 2019+ / 365 Enter Yes Fast
IF array All Ctrl+Shift+Enter (pre-365) No (treats as 0) Medium
SUMPRODUCT All Enter No (treats as 0) Slow on large data

For most users on modern Excel, MAXIFS is the best choice. It is readable, fast, and handles blanks gracefully. The array formula is a fallback for legacy versions. SUMPRODUCT is a last resort when you cannot use array entry, but it is less efficient over large datasets.

Frequently Asked Questions

Can I use MAXIFS with OR logic (e.g., East OR West)?

MAXIFS only supports AND logic—all criteria must be true. To do OR, you can use an array formula like =MAX(IF((A2:A20="East")+(A2:A20="West"), C2:C20)) (entered with Ctrl+Shift+Enter in older versions), or use MAXIFS twice and take the max: =MAX(MAXIFS(C2:C20,A2:A20,"East"), MAXIFS(C2:C20,A2:A20,"West")).

How do I find the maximum value for each group (e.g., per region)?

Use a pivot table: drag the region to Rows, the sales to Values, and set the value field to Max. Alternatively, use the MAXIFS function with a list of unique regions (use UNIQUE in Excel 365).

Does MAXIFS work with multiple columns in the max range?

No, MAXIFS expects a single range for the max values. If you need the max across multiple columns, use a helper column that combines them, or use an array formula like =MAX(IF((A2:A20="East")*(B2:B20="Gadget"), C2:E20)).

Why does MAXIFS return 0 instead of an error when no criteria match?

That is by design—it returns 0 because there are no values to compare. To display a blank, wrap it in IF(COUNTIFS(...)=0,"",MAXIFS(...)).

Can I use cell references for criteria in MAXIFS?

Yes, you can use cell references directly: =MAXIFS(C2:C20, A2:A20, E1, B2:B20, F1). This is recommended for flexibility.

Is there a way to get the second highest value with criteria?

Yes, use the LARGE function with an array formula: =LARGE(IF((A2:A20="East")*(B2:B20="Gadget"),C2:C20),2) (Ctrl+Shift+Enter in older versions). For Excel 365, you can use TAKE(SORT(FILTER(C2:C20,(A2:A20="East")*(B2:B20="Gadget")),1,-1),2).

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.