The fastest way to find the maximum date in Excel based on a criteria is with the MAXIFS function: =MAXIFS(date_range, criteria_range1, criteria1). For example, =MAXIFS(B2:B20, A2:A20, "North") returns the latest date in column B where column A equals “North”. If your Excel version doesn’t support MAXIFS (pre-2019), use an array formula with MAX and IF: =MAX(IF(A2:A20="North", B2:B20)), entered with Ctrl+Shift+Enter.
Why You Need This
Dates in Excel are stored as serial numbers, where 1 = January 1, 1900, and each day increments by 1. This means the “maximum” date is simply the largest serial number. When you filter data by a condition—like a product, region, or employee—you want the most recent date for that subset. Common use cases include finding the last order per customer, the latest payment received from a vendor, or the most recent maintenance date for each machine. Without a criteria-based max, you’d have to manually sort or use pivot tables, which are slower and less dynamic.
How MAXIFS Works
MAXIFS was introduced in Excel 2019 and is available in Microsoft 365. Its syntax is:
=MAXIFS(max_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)
- max_range: the range containing the dates you want to evaluate.
- criteria_range1: the range to check against the first condition.
- criteria1: the condition, which can be a value, cell reference, or expression (e.g., “>”&DATE(2024,1,1)).
Example: With dates in B2:B20 and regions in A2:A20, to get the latest date for “East”:
=MAXIFS(B2:B20, A2:A20, "East")
This returns the largest date in B2:B20 where the corresponding cell in A2:A20 is “East”. If no rows match, it returns 0 (which displays as 1/0/1900 if formatted as a date).
Array Formula Alternative (Pre-2019)
For older Excel versions, use an array formula. With the same layout, enter:
=MAX(IF(A2:A20="East", B2:B20))
After typing, press Ctrl+Shift+Enter (on Mac: Cmd+Shift+Enter). Excel wraps the formula in curly braces { } automatically. The IF function evaluates each cell in A2:A20; if it matches “East”, it returns the corresponding date from B2:B20; otherwise, it returns FALSE. MAX ignores logical values, so it finds the largest date among the matches. Note: If you edit the formula, you must re-enter it with Ctrl+Shift+Enter.
Using MAX with Multiple Criteria
To apply two or more conditions, you can multiply conditions inside the IF function. For example, to find the latest date for “East” region and “Product A” (with products in C2:C20):
=MAX(IF((A2:A20="East")*(C2:C20="Product A"), B2:B20))
The multiplication acts as an AND operator: each pair of conditions returns 1 if both true, 0 otherwise. Then IF returns the date only when the product is 1. This works in array formulas. In MAXIFS, just add another criteria pair: =MAXIFS(B2:B20, A2:A20, "East", C2:C20, "Product A").
Handling Blank Cells and Errors
Blank cells in the date range are ignored by MAXIFS and the array formula, because blank cells are treated as 0, but MAX ignores them if they are truly empty. However, if a cell contains a formula that returns an empty string (“”), that is not a real date and may cause issues. To exclude errors, wrap the array formula in IFERROR:
=MAX(IF(A2:A20="East", IF(ISNUMBER(B2:B20), B2:B20)))
This checks that B2:B20 contains a number (dates are numbers). For MAXIFS, errors in the criteria range are ignored, but errors in the max_range are not—they propagate. To avoid this, use AGGREGATE as a robust alternative:
=AGGREGATE(14, 6, B2:B20/(A2:A20="East"), 1)
Here, 14 means LARGE, 6 ignores error values, and dividing by the condition gives 1 for matches and #DIV/0! for non-matches, which are ignored. This returns the largest date without array entry.
Common Mistakes and Fixes
- Forgetting to format as date: If the result shows a number like 45123, apply a date format to the cell (Home > Number Format > Date).
- Using text dates: Ensure your dates are real date values, not text. Use
DATEVALUEto convert text. - Criteria with wildcards:
MAXIFSsupports wildcards (* and ?) for text criteria. For example, “E*” matches any region starting with E. - Array formula not updating: If you change the criteria cell, the array formula recalculates normally, but if you edit the formula itself, re-enter with Ctrl+Shift+Enter.
- Criteria referencing a cell: Use a cell reference for the criteria to make it dynamic:
=MAXIFS(B2:B20, A2:A20, D1)where D1 contains “East”.
Frequently Asked Questions
How do I get the max date for each category without typing each criteria?
Use a pivot table: drag the category field to Rows, the date field to Values, and set it to Max. Or use the MAXIFS with a helper column that lists unique categories (via UNIQUE in Microsoft 365).
Can I find the max date with a condition on the date itself, like after a certain date?
Yes, use a criteria like ">"&DATE(2024,1,1) in MAXIFS. For example, =MAXIFS(B2:B20, B2:B20, ">"&DATE(2024,1,1)) returns the latest date after Jan 1, 2024.
Why does my MAXIFS return 0 or 1/0/1900?
That means no rows meet the criteria. Check that the criteria text matches exactly (including spaces) and that the ranges are aligned. Also, ensure the max_range contains dates, not text.
What if I need the max date based on a criteria in another sheet?
Reference the other sheet directly: =MAXIFS(Sheet2!B:B, Sheet2!A:A, "East"). Use full column references carefully—they may slow down calculation.
Is there a way to do this without formulas, just visually?
Yes, use a pivot table or apply a filter to the data and sort by date descending—the top row shows the max date for the filtered set. But that is manual; formulas update automatically.
Does MAXIFS work in Excel for Mac or web?
Yes, MAXIFS is available in Excel for Microsoft 365 on Mac and in Excel for the web. The array formula with Ctrl+Shift+Enter also works on Mac (Cmd+Shift+Enter).
Related
- Generate Random Number HTML: JS & Math.random Code
- Google Sheets Percentage Increase Formula
- Make Two Clamp Racks from a Sheet of Plywood
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Weighted Average Rate in Excel: Formula and ExamplesTo calculate a weighted average rate in Excel, multiply each rate by its corresponding weight, add those products,…
- SQL Split String by Delimiter: Functions by DatabaseThere is no single SQL function for splitting a string by a delimiter across all databases. Use STRING_SPLIT…
- Excel ROUNDUP Formula: 10 Ways to Use ItThis listicle covers the ROUNDUP function in Microsoft Excel for Microsoft 365 on Windows, with Mac differences noted…
- Age Formula in Excel Without DATEDIFTo calculate age in completed years in Excel without DATEDIF, put a birth date in A2 and enter…
- Excel IF Statements: Examples and How to Use ThemExcel IF statements let you test a condition and return one value when it is true and another…
- Power Automate Trim String Function: How to Use ItThe trim() function in Power Automate removes leading and trailing whitespace (spaces, tabs, and newlines) from a string.…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.