Type =MAXIFS(D2:D11,C2:C11,”East”) to get the largest amount in D2:D11 on rows where column C says East, or =MINIFS(D2:D11,C2:C11,”East”) for the smallest. Both functions work in Excel for Microsoft 365 (Windows and Mac) and in Excel 2019, 2021 and 2024. Excel 2016 and earlier don’t include them, so a MAX and IF formula for older versions is covered further down.
What MAXIFS and MINIFS need from you
Both functions take the same pieces, in the same order:
- max_range (or min_range for MINIFS): the cells that hold the numbers you want the answer from, such as sales amounts or test scores.
- criteria_range1: the cells Excel checks to decide which rows count, such as a Region column.
- criteria1: the condition itself. Microsoft describes it as a number, expression or text, for example 1, “>500” or “East”.
- criteria_range2, criteria2 and so on: optional extra conditions. Each one is a pair (a range plus its condition), and you can add up to 126 pairs.
One rule matters more than any other: every criteria range must be the same size and shape as the max_range or min_range. If D2:D11 is ten cells tall, C2:C11 must be ten cells tall too. Mismatched sizes return a #VALUE! error instead of an answer.
A quick way to read any of these formulas out loud: “Find the biggest (or smallest) number here, but only on rows where this column matches that condition.”
The sample data used below
Priya keeps a small sales log with dates in column A, the sales rep in column B, the region in column C and the amount in column D. Headings are in row 1 and the data runs from row 2 to row 11.
| Date (A) | Rep (B) | Region (C) | Amount (D) |
|---|---|---|---|
| 3/2/2026 | Alex | East | 420 |
| 3/3/2026 | Jordan | West | 615 |
| 3/5/2026 | Priya | East | 980 |
| 3/9/2026 | Alex | East | 310 |
| 3/12/2026 | Jordan | East | 1150 |
| 3/16/2026 | Priya | West | 270 |
| 3/18/2026 | Alex | West | 840 |
| 3/23/2026 | Priya | East | 555 |
| 3/25/2026 | Jordan | West | 1320 |
| 3/30/2026 | Alex | East | 205 |
Type the same values into a blank sheet if you want to follow along and check each result as you go.
Find the largest value that meets one condition
This finds the biggest East sale.
- Click an empty cell outside the data, for example F2. Keeping results away from the data stops them from being caught in a sort or filter later.
- Type =MAXIFS( to start the formula. The first argument is always the range the answer comes from.
- Select D2:D11 (the amounts), then type a comma. This is the range the answer comes from.
- Select C2:C11 (the regions), then type a comma. This is where Excel looks for the condition.
- Type “East” with the quotation marks, then a closing parenthesis. Your formula reads =MAXIFS(D2:D11,C2:C11,”East”).
- Press Enter. F2 shows 1150, Jordan’s sale on 3/12. The larger 1320 is ignored because it’s a West sale.
If you plan to copy the formula to other cells, lock the ranges with dollar signs first, for example =MAXIFS($D$2:$D$11,$C$2:$C$11,”East”), so they don’t shift as you copy.
Switch to MINIFS for the smallest value
MINIFS is built the same way, with min_range first. In F3, type =MINIFS(D2:D11,C2:C11,”East”) and press Enter. The result is 205, Alex’s sale on 3/30. Change “East” to “West” in either formula and you get 1320 and 270 instead.
Putting the region in a cell makes this reusable. Type East in G1, then use =MAXIFS(D2:D11,C2:C11,G1). Change G1 to West and the answer updates without editing the formula.
Add a second condition
Each extra condition is another range and condition pair at the end of the formula. A row only counts when it meets every condition, so adding pairs narrows the results.
- Click F4 and type =MAXIFS(D2:D11,C2:C11,”East”,B2:B11,”Alex”).
- Press Enter. The answer is 420: Alex’s largest sale in the East. His 840 doesn’t count because it was in the West.
- For his smallest East sale, use the same pairs in MINIFS: =MINIFS(D2:D11,C2:C11,”East”,B2:B11,”Alex”) returns 205.
The pairs can be in any order, but each range must stay next to its own condition. Swapping “East” and “Alex” while leaving the ranges in place would make Excel look for Alex in the Region column and return 0.
Use comparisons, partial text and cell values as conditions
Microsoft notes that MAXIFS and MINIFS accept the same criteria as SUMIFS and AVERAGEIFS, so the usual criteria tricks apply:
- Greater or less than: put the operator and number inside one set of quotes. =MINIFS(D2:D11,D2:D11,”>500″) returns 555, the smallest sale above 500. The criteria range and the min_range can be the same cells.
- Not equal to: =MAXIFS(D2:D11,C2:C11,”<>West”) skips West rows and returns 1150.
- Wildcards: the SUMIFS help documents a question mark (?) for any single character and an asterisk (*) for any run of characters. =MAXIFS(D2:D11,B2:B11,”J*”) matches Jordan and returns 1320. To match a real question mark or asterisk, type a tilde (~) in front of it.
- A value in another cell: join the operator to the cell with an ampersand. With 1000 in G2, =MINIFS(D2:D11,D2:D11,”>”&G2) returns 1150. The operator goes in quotes; the cell reference doesn’t.
Watch out for an empty condition cell. In Microsoft’s own example, a criteria argument that points at a blank cell is treated as 0, so the formula quietly looks for zeros instead of returning an error. If a result suddenly looks odd, check that the cell your condition reads from isn’t empty.
Get the latest or earliest date for a condition
Excel stores dates as sequential serial numbers, so the “largest” date is the most recent one. That makes MAXIFS useful for questions like “when did the East region last make a sale?”
- In F5, type =MAXIFS(A2:A11,C2:C11,”East”) and press Enter.
- If you see a five-digit number instead of a date, the result cell isn’t formatted as a date yet. Select it and apply a date format: on the Home tab, open the Number Format list and choose Short Date. It now shows 3/30/2026.
- For the first West sale, use =MINIFS(A2:A11,C2:C11,”West”), which returns 3/3/2026 once it’s formatted as a date.
Dates also work as conditions. To find the largest sale between March 10 and March 20, use two conditions on the same date column and build each date with the DATE function, which takes year, month and day:
=MAXIFS(D2:D11,A2:A11,”>=”&DATE(2026,3,10),A2:A11,”<=”&DATE(2026,3,20))
Only the 3/12, 3/16 and 3/18 rows qualify, so the answer is 1150. Building dates with DATE keeps the year, month and day unambiguous in the formula.
Match one condition or another
MAXIFS and MINIFS only combine conditions with AND logic. Two conditions on the same column, such as Rep is Alex and Rep is Priya, can never both be true on one row, so =MAXIFS(D2:D11,B2:B11,”Alex”,B2:B11,”Priya”) returns 0.
For “Alex or Priya,” calculate each person separately and let MAX pick the larger result:
=MAX(MAXIFS(D2:D11,B2:B11,”Alex”),MAXIFS(D2:D11,B2:B11,”Priya”))
Alex’s best is 840 and Priya’s is 980, so the formula returns 980. The same pattern works with MIN wrapped around two MINIFS formulas.
Excel 2016 or earlier: use MAX with IF instead
Microsoft’s MAXIFS and MINIFS pages list Excel 2019 and later, plus Microsoft 365, so older versions need a different formula. MAX and IF together do the same job:
- Click an empty cell and type =MAX(IF(C2:C11=”East”,D2:D11)).
- In Excel 2016 or earlier, press Ctrl+Shift+Enter instead of Enter. That enters it as a legacy array formula, and Excel shows braces around it in the formula bar. In Microsoft 365, plain Enter is enough.
- The result is 1150. IF hands MAX the East amounts and FALSE for every other row, and MAX ignores logical values like FALSE when they come from an array.
Swap MAX for MIN to get 205. For two conditions, nest a second IF: =MAX(IF(C2:C11=”East”,IF(B2:B11=”Alex”,D2:D11))) returns 420.
When the result looks wrong
- #VALUE! means the ranges aren’t the same size or shape. Compare the row numbers in every range; D2:D11 next to C2:C12 is enough to break it.
- 0 means no row met every condition. Check spelling and stray spaces in the data, or confirm whether any rows should match at all. To show a message instead of 0, test the count first: =IF(COUNTIFS(C2:C11,G1)=0,”No sales”,MAXIFS(D2:D11,C2:C11,G1)). For lookups, replacing #N/A with a 0 or a message using IFNA uses a similar idea.
- #NAME? usually means a typo in the function name, which Microsoft lists as the top cause of that error. If the spelling is right, check which version of Excel is open: Microsoft lists MAXIFS and MINIFS only for Excel 2019 and later and Microsoft 365, so an older version can’t calculate them.
- The formula shows as text (you see =MAXIFS(…) in the cell). Either Show Formulas is on or the cell was formatted as Text before you typed; the fixes are in getting Excel to show results instead of formulas.
- Text criteria without quotes. =MAXIFS(D2:D11,C2:C11,East) won’t find the East rows. Put text in quotation marks, as in “East”, or in a cell you reference.
Confirm the answer and undo it
To check a result the first time, select any cell in the data and turn on a filter (Data > Filter), filter the Region column to East and sort Amount from largest to smallest. The top row should match your MAXIFS result and the bottom row your MINIFS result. Clear the filter when you’re done. A COUNTIFS formula with the same conditions, such as =COUNTIFS(C2:C11,”East”,B2:B11,”Alex”), tells you how many rows the formula considered (3 here).
Nothing about these functions changes your data, so undoing is simple: select the formula cell and press Delete, or press Ctrl+Z straight after entering it.
MAXIFS and MINIFS questions
Do the ranges have to start on the same row?
No. Microsoft’s second example pairs A2:A5 with B3:B6: the ranges are offset by one row but the same shape and size, and the formula still works. Excel compares the first cell of one range with the first cell of the other, and so on, so an offset is almost always a mistake in practice. Line them up unless you have a reason not to.
Does Microsoft list Excel for the web?
The MAXIFS and MINIFS pages list Excel for Microsoft 365, Excel for Microsoft 365 for Mac, and Excel 2019, 2021 and 2024 (2021 and 2024 for Mac as well). Excel for the web isn’t named on either page, so test the formula in the browser before relying on it for a shared workbook.
Try the two-condition formula on your own data first. Once that result matches a quick filter check, move the conditions into cells so one formula can answer any region or rep you type in. Microsoft’s MAXIFS function reference and MINIFS function reference have six worked examples each if you want more practice data.
Matthew Burleigh has been a freelance writer since the early 2000s. You can find his writing all over the Web, where his content has collectively been read millions of times.
Matthew received his Master’s degree in Computer Science, then spent over a decade as an IT consultant for small businesses before focusing on writing and website creation.
The topics he covers for MasterYourTech.com include iPhones, Microsoft Office, and Google Apps.
You can read his full bio here.