Cellwise Start free

Excel guide · 6 min read

MAX IF in Excel: find the largest value that meets a condition

Quick answerIn Excel 2019 and later use =MAXIFS(E2:E10,C2:C10,"West") to get the largest deal in the West region; add more range and condition pairs for more conditions. In Excel 365 =MAX(FILTER(E2:E10,C2:C10="West")) does the same and accepts any test. In Excel 2016 and older, use =MAX(IF(C2:C10="West",E2:E10)) confirmed with Ctrl+Shift+Enter. MAXIFS returns 0 when nothing matches, so check for that before you trust a 0.

Sample data

Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.

ABCDEFGH
1DateRepRegionProductDealRegionWest
2Sep 2, 2026Dana RuizEastSoftware4200
3Sep 5, 2026Omar HaddadWestHardware6800
4Sep 11, 2026Lena FischerEastHardware9150
5Sep 16, 2026Omar HaddadWestSoftware3900
6Sep 22, 2026Chris MooreSouthSoftware6800
7Sep 29, 2026Dana RuizEastServices2750
8Oct 3, 2026Priya NairWestHardware7400
9Oct 8, 2026Lena FischerEastSoftware9800
10Oct 14, 2026Chris MooreSouthHardware5100

Download this sheet as an Excel practice file (.xlsx)

MAXIFS: the simplest way (Excel 2019 and later)

The sheet is a list of sales deals with the date, rep, region, product and amount. To find the biggest deal in one region, MAXIFS takes the range to take the maximum from first, then a range to test and the condition: =MAXIFS(E2:E10,C2:C10,"West"). Point the condition at a cell instead of typing the text, =MAXIFS(E2:E10,C2:C10,H1), so you can change the region in H1 and the result follows.

For more conditions, keep adding pairs: =MAXIFS(E2:E10,C2:C10,"West",D2:D10,"Hardware") is the biggest West hardware deal. Every condition must be true for a row to count. Conditions are written like COUNTIFS and SUMIFS conditions, so dates and numbers go in quotes with an operator: =MAXIFS(E2:E10,A2:A10,">="&DATE(2026,10,1)) is the biggest deal since October 1.

MINIFS has exactly the same arguments and returns the smallest value. Both functions exist in Excel 2019, 2021, 2024, Microsoft 365 and Excel for the web. In Excel 2016 and older they return #NAME?. Every test range must be the same size as the first range, or the result is #VALUE!.

MAX with FILTER (Excel 365 and 2021)

FILTER keeps only the deals whose region equals H1, and MAX takes the largest of what is left. It gives the same answer as MAXIFS but accepts any test you can write as a formula, including OR conditions and tests on calculated values, which MAXIFS cannot do.

Like MAXIFS, the comparison ignores upper and lower case, so "west" also matches West.

=MAX(FILTER(E2:E10,C2:C10=H1))

Result: 7400

7400, Priya Nair's hardware deal in October. The other West deals are 6800 and 3900.

Several conditions, including a date range

Inside FILTER, multiply tests to require all of them (AND) and add them to accept any of them (OR). Each test gives TRUE or FALSE for every row, and multiplying turns them into 1 only where every test is true. Here the conditions are Hardware deals dated in September.

For OR, =MAX(FILTER(E2:E10,(C2:C10="East")+(C2:C10="South"))) is the biggest deal in either region. MAXIFS has no OR; you would need two MAXIFS inside MAX.

=MAX(FILTER(E2:E10,(D2:D10="Hardware")*(A2:A10>=DATE(2026,9,1))*(A2:A10<=DATE(2026,9,30))))

Result: 9150

9150, Lena Fischer's East hardware deal on September 11.

When nothing matches: 0, #CALC! or a message

There are no North deals. MAXIFS returns 0 in that case, which looks like a real result and can end up in a report as "biggest deal: 0". MAX(FILTER()) returns #CALC! instead, because FILTER has nothing to return. Neither tells your reader what happened.

Give FILTER a third argument, the value to use when it is empty, if 0 is acceptable: =MAX(FILTER(E2:E10,C2:C10="North",0)) returns 0 without the error. If 0 would mislead, check first with COUNTIFS and show a message, as below. The same check works around MAXIFS.

=IF(COUNTIFS(C2:C10,"North")=0,"No deals",MAX(FILTER(E2:E10,C2:C10="North",0)))

Result: No deals

No deals. For West the same formula returns 7400.

The gotcha: numbers stored as text are skipped

The East maximum looks like 9150. It is wrong: Lena Fischer's October deal in E9 is 9800, but it was imported as text, so MAX, MAXIFS and MAX(FILTER()) all skip it without any warning. You can spot it because the cell is left-aligned, has a green triangle, and =ISTEXT(E9) returns TRUE.

Fix the column once with Data > Text to Columns > Finish, or the warning icon's Convert to Number. In a FILTER formula you can also convert inside: the double minus turns text numbers into real numbers. Do not use -- if the column has words such as "TBC" in it; they turn into #VALUE!.

=MAX(FILTER(--E2:E10,C2:C10="East"))

Result: 9800

9800, the real largest East deal. Without the -- the result is 9150.

Who made the biggest deal? Return the name, not just the number

The usual approach is =INDEX(B2:B10,MATCH(MAX(FILTER(E2:E10,C2:C10="South")),E2:E10,0)). It finds the South maximum, 6800, then searches the whole amount column for 6800. The first 6800 belongs to Omar Haddad in the West, so the formula returns Omar Haddad, the wrong person in the wrong region, with no error.

Search for both things at once: the region and the amount. In XLOOKUP, multiplying the two tests gives 1 only on the row where both are true, and XLOOKUP looks for that 1. If two deals in the same region tie for the maximum, it returns the first one.

=XLOOKUP(1,(C2:C10="South")*(E2:E10=MAX(FILTER(E2:E10,C2:C10="South"))),B2:B10)

Result: Chris Moore

Chris Moore, whose 6800 deal is the largest in the South.

Excel 2016 and older: MAX(IF()) as an array formula

Before MAXIFS and FILTER, the standard way was MAX wrapped around IF. IF returns the amount where the region matches and FALSE everywhere else, and MAX ignores the FALSE values. In Excel 2016 and older you must press Ctrl+Shift+Enter instead of Enter, and Excel shows curly braces around the formula. Press plain Enter and you get a wrong result or #VALUE!. In Excel 365 and 2021, Enter is enough.

For the smallest value, use =MIN(IF(C2:C10="West",E2:E10)), which returns 3900. A shortcut you may see online, =MIN((C2:C10="West")*E2:E10), returns 0, because every non-West row becomes 0. Multiplying only works for MAX, and only when all values are positive.

=MAX(IF(C2:C10="West",E2:E10))

Result: 7400

7400, the same as MAXIFS and MAX(FILTER()).

Which method to pick

Excel 2019 or later and simple AND conditions: MAXIFS. It is short, uses the same condition style as SUMIFS and COUNTIFS, and is easy for others to read. Excel 365 or 2021 and you need OR, a calculated test or a clear "no match" result: MAX(FILTER()). File must open in Excel 2016 or older: MAX(IF()) with Ctrl+Shift+Enter.

Whichever you pick, check two things before you publish the number: that a 0 really means "the largest is 0" and not "nothing matched", and that the amount column has no text numbers.

Common mistakes

Trusting a 0 from MAXIFS

MAXIFS returns 0 when no row matches, often because of a typo or a trailing space in the condition. Count the matches with COUNTIFS and show a message when the count is 0.

Using INDEX/MATCH on the maximum alone to get the name

The same amount can appear in another group, so MATCH finds the wrong row. Match on the group and the amount together, as in the XLOOKUP(1,(...)*(...)) formula.

Pressing Enter on MAX(IF()) in Excel 2016 or older

Confirm it with Ctrl+Shift+Enter so it runs as an array formula, or switch to MAXIFS if you have Excel 2019 or later.

Amounts stored as text

MAX and MAXIFS skip them silently. Convert the column with Data > Text to Columns, or use -- inside FILTER.

FAQ

Is there a MAXIF function in Excel?

No, there is no MAXIF without the S. MAXIFS handles one condition or many, and it exists in Excel 2019 and later. In older versions use MAX(IF()) as an array formula.

How do I find the latest date for a person or customer?

Dates are numbers, so MAX works on them. =MAX(FILTER(A2:A10,B2:B10="Dana Ruiz")) gives Dana Ruiz's most recent deal date, Sep 29, 2026, once the cell is formatted as a date. MAXIFS(A2:A10,B2:B10,"Dana Ruiz") works too.

Why does MAXIFS return 0?

No row met every condition. Check the spelling of the condition text, look for trailing spaces in the data with LEN, and make sure the values are real numbers and dates, not text.

Is MAXIFS case-sensitive?

No. "west" and "West" match the same rows. The same is true for FILTER with an = test.

Why does MAXIFS show #NAME?

Your Excel is 2016 or older and has no MAXIFS, or the name is misspelled. Use =MAX(IF(range=condition,values)) with Ctrl+Shift+Enter instead.

Functions used

Related guides

Updated