Function Problems

Match Names and Return IDs from Another Excel Worksheet

Khadija KhanKhadija Khan Nov 18, 2026 869 views

Question details

Populate an ID column by matching names against a name-and-ID list on another worksheet.

Match Names and Return IDs from Another Excel Worksheet
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet contains names that need corresponding IDs from a lookup list on a second worksheet.
Observed behavior
Each name should return its matching ID, or a message if no match is found.
Before you start

Check which columns contain the names and IDs on both worksheets. The examples assume names are in column A on Sheet1 and that Sheet2 has names in column A and IDs in column B.

Solution 1Recommended

Use XLOOKUP to Return IDs for a Range of Names

Use this method in Excel 365 or Excel 2021 to populate multiple ID cells with one formula.

1
Select the first ID cell

On Sheet1, click cell B2 next to the first name.

2
Enter the XLOOKUP formula

In the formula bar, enter =XLOOKUP(A2:A7,Sheet2!A2:A4,Sheet2!B2:B4,"ID Not Found") and press Enter. Adjust the ranges and worksheet name to match your data.

3
Check the results

Review the IDs that spill down from B2. Clear any existing content in the spill area if Excel displays a spill error.

Use XLOOKUP to Return IDs for a Range of Names
Duplicate names: XLOOKUP returns the first matching name. If names are duplicated, use a unique identifier to distinguish the records.
Match names across worksheets

Return Matching IDs with WPS Spreadsheets

Use VLOOKUP and IFERROR in WPS Spreadsheets to match names on one worksheet with IDs on another, then fill the formula down.

  1. 1. Open the workbook: Open your Excel workbook in WPS Spreadsheets and select the worksheet containing the names.
  2. 2. Enter the lookup formula: Click the first ID cell, such as B2, and enter =IFERROR(VLOOKUP(A2,Sheet2!A:B,2,FALSE),"ID Not Found"). Change the sheet name and columns if needed.
  3. 3. Fill down: Press Enter, then drag the fill handle from B2 down to the last name.
  4. 4. Check and save: Review any "ID Not Found" results, then use File > Save to save the workbook.
Match names across worksheets and return their IDsOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceFill a lookup formula down an ID column
microsoft office alternative - wps office

Frequently Asked Questions

Why does my formula return ID Not Found for a name?

Check that the name exists on Sheet2 and that the formula references the correct columns. Extra spaces or differences in spelling can prevent an exact match.

What happens if the lookup list contains duplicate names?

Both XLOOKUP and VLOOKUP return the first matching name in these examples. Use a unique identifier if each duplicate needs a different ID.

Why does XLOOKUP show a spill error?

The cells below the formula may contain data. Clear the intended output area below B2 and try again.

How do I reference a worksheet whose name contains spaces?

Enclose the worksheet name in single quotes, as in 'Employee List'!A:B. Replace Sheet2!A:B in the VLOOKUP formula with that reference.