Find the Latest Date and Location for a Serial Number in Excel
Question details
Find the latest date for a serial number that appears more than once and return the location from the matching row.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A master list contains serial numbers, dates, and locations, with multiple records for some serial numbers.
- Observed behavior
- The desired result is the most recent date for the requested serial number and the corresponding location.
Check that serial numbers are consistent and that the date column contains actual Excel dates rather than text. The formulas below assume serial numbers in A2:A8, dates in B2:B8, locations in C2:C8, and the requested serial number in E2.
Use MAXIFS and LOOKUP to return the latest matching record
Use these formulas when your Excel version supports MAXIFS and you want the latest date and its matching location in separate cells.
MAXIFS finds the latest date for the serial number. LOOKUP then finds the last row that matches both the serial number and that date.
Type the serial number to find in cell E2.
In F2, enter =IF(COUNTIFS(A$2:A$8,E2,B$2:B$8,">0")=0,"",MAXIFS(B$2:B$8,A$2:A$8,E2)) and format F2 as a date using Home > Number Format.
In G2, enter =IF(F2="","",LOOKUP(2,1/((A$2:A$8=E2)*(B$2:B$8=F2)),C$2:C$8)).
Replace the row 8 endpoints in both formulas with the last row of your master list. Keep the serial number, date, and location ranges aligned.

Find the Latest Date and Location in WPS Spreadsheet
Use WPS Spreadsheet formulas to find the latest date for a serial number and retrieve the location from the matching row.
- 1. Open the workbook: Open WPS Spreadsheet and select Open to load the workbook containing the master list.
- 2. Enter the lookup value: With serial numbers in A2:A8, dates in B2:B8, and locations in C2:C8, enter the requested serial number in E2.
- 3. Calculate the latest date: In F2, enter =IF(COUNTIFS(A$2:A$8,E2,B$2:B$8,">0")=0,"",MAXIFS(B$2:B$8,A$2:A$8,E2)). Use the Home tab to format F2 as a date.
- 4. Find the location: In G2, enter =IF(F2="","",LOOKUP(2,1/((A$2:A$8=E2)*(B$2:B$8=F2)),C$2:C$8)). Adjust the range endpoints to cover your list.

Frequently Asked Questions
Why not use VLOOKUP alone to find the latest record?
VLOOKUP returns a matching row but does not automatically choose the one with the latest date. MAXIFS finds the maximum date first, and LOOKUP retrieves the location from a row matching that date and serial number.
What happens if two records have the same latest date?
The LOOKUP formula returns the location from the last row in the specified ranges that matches both the serial number and the latest date.
Why is the latest date showing as a number?
Excel stores dates as numeric values. Select F2 and choose a date format from Home > Number Format.
Why do the result cells remain blank?
Check that E2 matches a serial number in column A and that at least one matching date in column B is a positive Excel date value, not text. The formulas leave the results blank when no qualifying date is found.
How do I include more rows in the lookup?
Change A$2:A$8, B$2:B$8, and C$2:C$8 in the formulas to end at the last row of your master list. All three ranges must cover the same rows.




