Function Problems

Find the Latest Date and Location for a Serial Number in Excel

Huda QurayshiHuda Qurayshi Nov 25, 2026 869 views

Question details

Find the latest date for a serial number that appears more than once and return the location from the matching row.

Find the Latest Date and Matching Location in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Enter the serial number

Type the serial number to find in cell E2.

2
Find 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)) and format F2 as a date using Home > Number Format.

3
Return the location

In G2, enter =IF(F2="","",LOOKUP(2,1/((A$2:A$8=E2)*(B$2:B$8=F2)),C$2:C$8)).

4
Adjust the ranges

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.

Use MAXIFS and LOOKUP to return the latest matching record
Duplicate latest dates: If multiple rows have the same serial number and latest date, LOOKUP returns the location from the last matching row. If there is no matching serial number with a positive date value, both result cells remain blank.
Calculate the latest matching record

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. 1. Open the workbook: Open WPS Spreadsheet and select Open to load the workbook containing the master list.
  2. 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. 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. 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.
Find the latest date and matching location without sorting the master list.Open and save Microsoft Excel XLSX and XLS files.Use a familiar spreadsheet interface for working with formulas.Use WPS Office for free.
QA img-9

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.