Matching data between two Excel sheets lets you compare, merge, or validate information across workbooks or worksheets—common in finance, inventory, HR, and reporting. This guide uses Excel’s built-in functions like XLOOKUP or INDEX/MATCH, which work reliably without VBA. No special tools or add-ins are required, but you’ll need both sheets open in the same workbook or accessible as separate files.
What You'll Need
- Excel installed (Microsoft 365, Excel 2021, or Excel 2019+ recommended for XLOOKUP; older versions can use INDEX/MATCH)
- Both data sets organized with a unique identifier column (e.g., Employee ID, SKU, Account Number)
- Source data in one sheet (e.g., "Sheet2") and lookup data in another (e.g., "Sheet1")
- Consistent formatting in key columns (no leading/trailing spaces, same data types)
Step-by-Step
- Open your Excel workbook containing both sheets. If the data is in separate files, open both and copy one sheet into the other workbook (right-click sheet tab > Move or Copy > check "Create a copy" > select the target workbook).
- Identify the lookup column in both sheets—the column that contains matching values (e.g., "ID" in Sheet1 and "ID" in Sheet2). Ensure it’s the first column in your lookup range or use full-column references safely.
- Decide where to place the matched result. In Sheet1, click the cell where you want the matched value to appear (e.g., cell D2 in Sheet1 if you want to pull a "Salary" value from Sheet2).
- Enter the XLOOKUP formula (best for modern Excel):
=XLOOKUP(A2,Sheet2!$A:$A,Sheet2!$C:$C,"Not Found")
—Replace A2 with your lookup value cell, Sheet2!$A:$A with the full lookup column in Sheet2, Sheet2!$C:$C with the return column in Sheet2, and adjust "Not Found" to a custom message or blank ("", if preferred). - Press Enter, then drag the fill handle (small square at the bottom-right of the cell) down to apply the formula to all rows in your dataset.
- For older Excel versions (without XLOOKUP), use INDEX and MATCH:
=IFERROR(INDEX(Sheet2!$C:$C,MATCH(A2,Sheet2!$A:$A,0)),"Not Found")
—A2 is the lookup value in Sheet1, Sheet2!$A:$A is the column to search, Sheet2!$C:$C is the column to return, and 0 forces an exact match. - Verify accuracy by spot-checking a few matches. For example, manually confirm that ID 1001 in Sheet1 matches the correct row in Sheet2 and returns the expected value.
Common Mistakes
- Using partial matches by accident: XLOOKUP and MATCH default to exact match only when set to 0 (or -1/1 for sorted data—avoid unless intentional). Leaving the match mode blank can cause errors if data isn’t sorted.
- Incorrect column references: Referencing Sheet2!C:C instead of the correct return column (e.g., Column D for Salary if Salary is in D) pulls wrong data. Always double-check column letters.
- Leading/trailing spaces: IDs like "A1001 " and "A1001" won’t match. Use =TRIM(A2) in a helper column or apply Text to Columns to clean data first.
- Case sensitivity: XLOOKUP and MATCH are case-insensitive. "abc" and "ABC" are treated as equal, which may be desirable or not—adjust data or use EXACT in VBA if needed.
- Hidden rows or filters: Formulas still reference hidden rows. If sheets are filtered, the match may return incorrect values; unfilter before matching or use structured references (tables).
Tips
- Convert ranges to tables: Press Ctrl+T on each data range, name them (e.g., tblData, tblLookup), and use table syntax like =XLOOKUP([@ID],tblLookup[ID],tblLookup[Salary])—this auto-expands and prevents reference drift.
- Use helper columns for cleaning: Add =TRIM(CLEAN(A2)) to strip nonprinting characters and extra spaces. Apply this to both lookup and source IDs.
- Lock references with $: Always use absolute references (e.g., $A:$A, $C:$C) when dragging formulas to avoid shifting ranges.
- Test with a small subset: Before applying to 10,000 rows, test on 5 rows to catch errors early.
- Highlight mismatches: Use conditional formatting: select your result column > Home > Conditional Formatting > New Rule > Use a formula > =D2="Not Found" > set red fill. This visually flags unmatched rows.
- Sort for clarity: Sort both sheets by the ID column before matching—it doesn’t affect formula results, but makes manual verification easier.
Troubleshooting
If your formula returns #N/A, #REF!, or wrong values, follow this checklist:
- Check for #N/A: The lookup value doesn’t exist in the source sheet. Confirm the ID exists in Sheet2 (Ctrl+F to search). Also verify no extra spaces—use =LEN(A2) and =LEN(Sheet2!A2) to compare text lengths.
- Verify sheet names: Typos like "Shee2" instead of "Sheet2" break references. Check the sheet tab name exactly (including spaces).
- Ensure no merged cells in the lookup column: Merged cells cause INDEX/MATCH and XLOOKUP to skip rows. Unmerge by selecting the range > Home > Merge & Center > Unmerge Cells.
- Confirm data types match: One column may be text ("1001") while the other is numeric (1001). Convert text to numbers: select the column > Data > Text to Columns > Finish.
- Check for hidden characters: Use =CODE(LEFT(A2)) to see if the first character is non-printing (ASCII < 32). Apply CLEAN() or TRIM() to clean.
- Test with a simple example: In a blank worksheet, type "A" in A1, "B" in A2 on Sheet1. Put "A" in Sheet2 A1, "Match1" in B1. Try =XLOOKUP(A1,Sheet2!A:A,Sheet2!B:B). If it works, your data or sheet references are the issue.
- Enable iterative calculations only if needed: Rarely, circular references from copy-pasting formulas cause errors. Go to File > Options > Formulas > uncheck "Enable iterative calculation" unless required.