To return the largest value that meets a condition in Excel for Microsoft 365, use =MAXIFS(B2:B10,A2:A10,"North"). Here, A2:A10 contains regions and B2:B10 contains values; the formula returns the largest value in the North rows. For multiple conditions, add another criteria range and criterion pair to MAXIFS.
How MAXIFS works
MAXIFS finds the maximum number in a target range, but only among rows that satisfy one or more conditions. Its syntax is =MAXIFS(max_range,criteria_range1,criteria1,[criteria_range2,criteria2],...). The first argument is the range whose values Excel compares; each following pair identifies a range to test and the condition to apply.
For example, suppose a sales table has Region in A2:A10, Product in B2:B10, and Sales in C2:C10. With that layout, use =MAXIFS(C2:C10,A2:A10,"North") to find the largest sale from the North region. If the North sales are 240, 510, and 375, the result is 510.
Conditions can be text, numbers, expressions, or references to cells. Text criteria such as a region name go in double quotes. To use a comparison operator with a number, join the operator to the value with an ampersand. With sales in C2:C10 and dates in D2:D10, this returns the largest sale of at least 500 made on or after January 1, 2026: =MAXIFS(C2:C10,C2:C10,">=500",D2:D10,">="&DATE(2026,1,1)).
Using more than one criterion
MAXIFS applies all its criteria together: a row must meet every supplied condition to be included. In the sales layout above, this finds the largest sale for the North region for the product named Widget: =MAXIFS(C2:C10,A2:A10,"North",B2:B10,"Widget").
Criteria are often better stored in worksheet cells than typed into a formula. If F2 contains the region and G2 contains the product, use =MAXIFS(C2:C10,A2:A10,F2,B2:B10,G2). This makes it easy to change the selection without editing the formula. For a threshold stored in H2, write the criterion as ">="&H2 within the formula; the ampersand combines the operator with the cell’s value.
- Exact text: use a cell reference or a quoted value such as
"North". - Greater or less than: use criteria such as
">100"or"<="&H2. - Dates: use a real date value, often created with DATE, and combine it with a comparison operator when needed.
- Wildcards: use an asterisk for any number of characters or a question mark for one character, such as
"East*". Use a tilde to match a wildcard character literally.
Text comparisons in MAXIFS are not case-sensitive, so North and NORTH match the same entries. If case distinctions matter, a different approach using functions such as MAX and EXACT is needed.
Set up the ranges correctly
Every criteria range must have the same dimensions and shape as the maximum range. If the maximum range is C2:C100, use criteria ranges that also cover rows 2 through 100, not A2:A99 or B1:B100. Mismatched ranges can produce a #VALUE! error. Keep headings out of the ranges, and make sure each row’s criteria and value refer to the same record.
MAXIFS is available in Excel for Microsoft 365, Excel 2019, and later supported releases. It is not available in Excel 2016 or Excel 2013. Excel for the web supports MAXIFS. The formula syntax is the same on Windows and Mac, although separators may display differently in installations configured to use semicolons instead of commas.
For a growing dataset, convert the range to an Excel Table with Insert > Table. Structured references can then make formulas easier to read and allow the referenced data to expand when rows are added. If the table is named SalesData and its columns are Region and Amount, a North-region maximum can be written as =MAXIFS(SalesData[Amount],SalesData[Region],"North").
What if MAXIFS is unavailable?
In older Excel versions, an array formula can calculate a conditional maximum. With regions in A2:A10 and values in B2:B10, use =MAX(IF(A2:A10="North",B2:B10)). In Excel 2016 or 2013, confirm it with Ctrl+Shift+Enter rather than Enter alone; Excel displays curly braces around a successfully entered array formula, but do not type those braces yourself. In current Microsoft 365 Excel, Enter is sufficient for this formula.
Another older-version option is a helper column. With regions in A2:A10 and values in B2:B10, put =IF(A2="North",B2,"") in C2 and fill it down through C10. Then use =MAX(C2:C10). The helper column is easier to inspect, particularly when the criteria are complicated, but it adds a column to the worksheet.
Common problems and edge cases
If MAXIFS returns 0 unexpectedly, check whether any rows actually meet all criteria and whether the qualifying cells contain numbers. MAXIFS ignores text and blank cells in the maximum range. If no row meets the conditions, it returns 0, which can be indistinguishable from a genuine maximum of zero. You can test for a match separately or display a message by using a count of qualifying rows.
For example, with regions in A2:A10, this formula returns a message when there are no North records, and otherwise returns the maximum North value in B2:B10: =IF(COUNTIF(A2:A10,"North")=0,"No matching rows",MAXIFS(B2:B10,A2:A10,"North")). If the criteria include additional conditions, use COUNTIFS with the same criteria pairs so the check matches MAXIFS.
Other frequent causes of surprising results include numbers stored as text, extra spaces in labels, and criteria ranges that do not align with the values. A date that looks like a date but is stored as text may fail a date comparison. Normalize imported data, check cell types, and consider TRIM for text with unwanted spaces. Also remember that MAXIFS returns the largest value, not the row or name associated with it.
Return the record associated with the maximum
To return a related label as well as the maximum, first calculate the maximum, then look up a row matching both the criteria and that value. In Microsoft 365, with names in A2:A10, regions in B2:B10, and values in C2:C10, this returns a name for the largest North-region value: =XLOOKUP(1,(B2:B10="North")*(C2:C10=MAXIFS(C2:C10,B2:B10,"North")),A2:A10,"No match"). XLOOKUP is available in Microsoft 365 and Excel 2021 or later. If multiple records tie for the maximum, this formula returns the first matching name; it does not list every tie.
If all tied records matter, filter the rows whose region matches and whose value equals the conditional maximum. FILTER is available in Microsoft 365 and Excel 2021 or later. In the same layout, =FILTER(A2:A10,(B2:B10="North")*(C2:C10=MAXIFS(C2:C10,B2:B10,"North")),"No match") returns every matching name, including ties.
Frequently Asked Questions
Can MAXIFS use several conditions?
Yes. Add a criteria range and criterion for each condition. All conditions must be true for a row to qualify.
Does MAXIFS return the row with the highest value?
No. It returns the maximum value only. Use a lookup or filter formula to return the associated name or record.
Why does MAXIFS return zero when there is no match?
Zero is the function’s result when no qualifying numeric value is found. Check whether any rows meet the conditions, and use COUNTIFS to distinguish no match from a genuine zero.
Can MAXIFS check dates?
Yes. Excel dates are stored as numbers, so MAXIFS can compare them using criteria such as a date reference or a criterion built with ">="&DATE(2026,1,1). Ensure the cells contain real Excel dates, not text that merely looks like a date.
How can I find the second-largest value that meets a condition?
MAXIFS returns only the largest qualifying value. For a second-largest value, filter the qualifying values and use LARGE on the filtered results in Microsoft 365 or Excel 2021, or use an array formula in older Excel. Decide how ties should be handled because duplicate maximum values affect what “second-largest” means.
Related
- Excel Find Max Value Based on Criteria in Your Data
- Conditional Formatting Color Based on Value in Excel
- Excel Cell Value Based on Another Cell?
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Hotel Group Jobs: Hiring, Pay, and How to ApplyExcel Hotel Group jobs are positions at a hotel management and development company that operates branded and independent…
- How to Add a Shared Mailbox to Outlook on Any DeviceTo add a shared mailbox in Outlook, first ask your Microsoft 365 or Exchange administrator to grant your…
- Excel Keyboard Shortcuts to Delete a RowIn Excel for Microsoft 365 on Windows, press Shift+Space to select the current row, then press Ctrl+- (Ctrl…
- Excel AVERAGE: What It Ignores and IncludesIn Excel, AVERAGE ignores empty cells, text, and logical values such as TRUE or FALSE when they are…
- Excel Data Validation List Source ExplainedIn Excel for Microsoft 365 on Windows, a data validation list source is the set of entries that…
- Wrap Text in Google Sheets: Steps, Options, and FixesTo wrap text in Google Sheets in a web browser, select the cell or range, then choose Format…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.