Return a Value Based on the Maximum Date for a Matching Index in Excel
Question details
Return a value from a specific column based on a matching lookup index and the maximum (latest) date in another column.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- The user needs to extract data associated with the latest record for a specific identifier, but previous formula attempts returned incorrect values when multiple dates were identical.
- Observed behavior
- The goal is to filter records by an index, find the maximum expiration date, and safely return the corresponding value even if multiple rows share the same latest date.
Ensure your date column is formatted as actual dates rather than text, so the MAXIFS function can accurately evaluate which date is the latest.
Use the XLOOKUP and MAXIFS Formula
Combine XLOOKUP with MAXIFS to look up data based on multiple conditions, ensuring you capture the latest date associated strictly with your target index.
This approach multiplies two logical arrays to ensure both the index matches and the date equals the maximum date for that specific index. It successfully prevents data mismatch when different indexes share the same date.
Click on the blank cell where you want the returned value to be displayed.
Type the formula =XLOOKUP(1,(A2:A7=F2)*(D2:D7=MAXIFS(D2:D7,A2:A7,F2)),B2:B7,"No match"). Adjust A2:A7 to your index range, D2:D7 to your date range, and B2:B7 to the column containing the desired return value.
Press Enter on your keyboard. The formula will evaluate the highest date for the index specified in cell F2 and return the corresponding row's value.
Extract Using Dynamic Array Functions
Use modern dynamic array functions to filter the dataset by the index, sort it by date descending, and extract the top result.
Use WPS Spreadsheet to Handle Complex Lookups
WPS Spreadsheet fully supports modern dynamic array functions like XLOOKUP, MAXIFS, and FILTER. You can seamlessly execute advanced data lookups just like you would in Excel, without worrying about syntax changes.
- 1. Open your workbook: Launch WPS Spreadsheet and open the document containing your data.
- 2. Select the target cell: Click on the cell where you want to output the latest record's value.
- 3. Input the formula: Enter the XLOOKUP and MAXIFS formula exactly as you would in Excel.
- 4. Get the result instantly: Press Enter to instantly process the data arrays and view your precise matched value.

Frequently Asked Questions
Why does my INDEX and MATCH formula return the wrong value when there are duplicate dates?
Standard MATCH functions typically return the first occurrence of a lookup value. If multiple records across different indexes have the same maximum date, MATCH might grab a row belonging to the wrong index. Using XLOOKUP with dual criteria (multiplying the arrays) ensures both the index and date strictly match.
How does the MAXIFS function work in this scenario?
MAXIFS evaluates a numeric range (in this case, Excel serial dates) and returns the highest value (the latest date) that meets your specified conditions, such as matching your specific lookup index.
What happens if multiple records have the exact same index and maximum date?
By default, the provided XLOOKUP formula evaluates data from top to bottom and returns the first matching result it encounters. If you need to retrieve a specific record during a tie, you must add an additional tie-breaker column or condition to the formula.




