Match Names and Return IDs from Another Excel Worksheet
Question details
Populate an ID column by matching names against a name-and-ID list on another 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.
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.
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.
On Sheet1, click cell B2 next to the first name.
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.
Review the IDs that spill down from B2. Clear any existing content in the spill area if Excel displays a spill error.

Use VLOOKUP and IFERROR in Older Excel Versions
Use this row-by-row formula when XLOOKUP is unavailable.
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. Open the workbook: Open your Excel workbook in WPS Spreadsheets and select the worksheet containing the names.
- 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. Fill down: Press Enter, then drag the fill handle from B2 down to the last name.
- 4. Check and save: Review any "ID Not Found" results, then use File > Save to save the workbook.

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.




