Example 1
Largest value for one department
C11 =MAXIFS(C2:C9,A2:A9,"IT")
Result: 6,100
IT has three rows (4,200, 6,100 and 5,200). The largest is 6,100.
C11 =MAXIFS(C2:C9,A2:A9,"IT") returns 6,100
Returns the largest value in a range among the rows that meet one or more conditions, such as the biggest spend for one department.
Syntax
=MAXIFS(, , , [criteria_range2, criteria2], ...)
Excel 2019, Excel 2021, Excel 2024, Excel for Microsoft 365 and Excel for the web. Not in the perpetual versions Excel 2016 and earlier.
Try it
Edit the formula in C11 or change the inputs. The sheet recalculates as you type.
C11 =MAXIFS(C2:C9,A2:A9,"IT") returns 6,100
MAXIFS finds the largest number among the rows that pass your tests. It answers "what is the biggest spend in IT?", "what is the longest delay for Grade A suppliers?" and "what is the latest date for this customer?" with one formula.
The range to take the maximum from comes first, then pairs of test range and condition:
=MAXIFS(C2:C9, A2:A9, "IT", B2:B9, "Q1")
This is the same layout as AVERAGEIFS and COUNTIFS. Every criteria range must be the same size and shape as max_range, or MAXIFS returns #VALUE!.
Conditions behave as they do in COUNTIF:
"IT", matches whole cells and ignores case.">100", "<>East"."Lap*", "?ccess".">"&E2 joins an operator to a cell.All conditions must be true for a row to count (AND logic). You can test the max_range column itself: =MAXIFS(C2:C9, C2:C9, "<5000") returns the largest value below 5,000.
If no row meets all the conditions, MAXIFS returns 0, not an error. That is easy to mistake for a real maximum. When it matters, check the count first: =IF(COUNTIFS(A2:A9,"Legal")=0,"No rows",MAXIFS(C2:C9,A2:A9,"Legal")).
MAXIFS works with dates, so =MAXIFS(B2:B50, A2:A50, E1) returns the latest date for the customer named in E1. It works on numbers only: it will not return the "largest" text.
Before Excel 2019, people used =MAX(IF(A2:A9="IT", C2:C9)), which needs Ctrl+Shift+Enter in Excel 2016 and earlier. In Microsoft 365 the same formula works as typed. Another route is AGGREGATE: =AGGREGATE(14, 6, C2:C9/(A2:A9="IT"), 1). If a workbook has to open in Excel 2016, avoid MAXIFS, because it shows #NAME? there.
The matching function for the smallest value is MINIFS. With no conditions, use MAX.
C2:C9.A2:A9. It must be the same size and shape as max_range.">100", "<>East" or "Lap*". Text and operators go in quotes.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
C11 =MAXIFS(C2:C9,A2:A9,"IT")
Result: 6,100
IT has three rows (4,200, 6,100 and 5,200). The largest is 6,100.
C11 =MAXIFS(C2:C9,A2:A9,"IT") returns 6,100
Example 2
C11 =MAXIFS(C2:C9,A2:A9,"IT",B2:B9,"Q1")
Result: 5,200
Only two rows are both IT and Q1: 4,200 and 5,200. The larger is 5,200.
C11 =MAXIFS(C2:C9,A2:A9,"IT",B2:B9,"Q1") returns 5,200
Example 3
C11 =MAXIFS(C2:C9,C2:C9,"<5000")
Result: 4,800
The max_range can also be the range you test. Of the values below 5,000, the largest is 4,800.
C11 =MAXIFS(C2:C9,C2:C9,"<5000") returns 4,800
Example 4
C11 =MAXIFS(C2:C9,A2:A9,"Legal")
Result: 0
There is no Legal row, so MAXIFS returns 0 instead of an error. Check with COUNTIFS if that could be confused with a real zero.
C11 =MAXIFS(C2:C9,A2:A9,"Legal") returns 0
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In F2, return the longest time to fix for the team named in E2.
Answer in F2.
#VALUE! means the criteria ranges are not the same size as max_range. Make every range start and end on the same rows.#NAME? in Excel 2016 and earlier. If the file has to open there, use MAX(IF(...)) or AGGREGATE instead."E2", is treated as the text E2. Write E2, or ">"&E2 to combine it with an operator.No. MAXIFS was added in Excel 2019 and Microsoft 365. In Excel 2016 and earlier, use `=MAX(IF(A2:A9="IT",C2:C9))` confirmed with Ctrl+Shift+Enter.
Either the largest matching value really is 0, or no row met all the conditions. Check the spelling and spaces in your criteria, and test with COUNTIFS.
Not directly. Take the larger of two results: `=MAX(MAXIFS(C2:C9,A2:A9,"IT"),MAXIFS(C2:C9,A2:A9,"HR"))`.
Use LARGE with FILTER in Microsoft 365: `=LARGE(FILTER(C2:C9,A2:A9="IT"),2)`.
MAXIFS is taught in Data analysis with formulas, lesson 6: MAXIFS and MINIFS. Each lesson is a short, graded exercise like the one above.