Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Match Data in Two Excel Spreadsheets

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Matching data between two Excel spreadsheets lets you compare, merge, or identify differences between datasets—useful for updating records, finding duplicates, or validating entries. You’ll need both spreadsheets open in Excel, with a common identifier (like an ID number, email, or product code) present in both files. No add-ins or advanced tools are required—Excel’s built-in functions handle this reliably.

What You'll Need

  • Both Excel workbooks (spreadsheets) saved locally or on OneDrive/SharePoint
  • A shared column with matching values (e.g., Employee ID, Order Number, SKU)
  • Excel installed (Microsoft 365, 2021, 2019, or newer)

Step-by-Step

  1. Open both Excel workbooks. Ensure each has a consistent, clean identifier column (no leading/trailing spaces or mixed formatting). For this guide, assume Workbook1 (Sheet1) contains the base data, and Workbook2 (Sheet2) holds updated values you want to pull back.
  2. Decide which data to match and where to place results. For example, to pull a “Status” column from Workbook2 into Workbook1, create a new column in Workbook1 (e.g., column D) labeled “Matched Status”.
  3. In the first data row of your new column (e.g., D2 in Workbook1), enter the XLOOKUP function: =XLOOKUP(A2,[Workbook2.xlsx]Sheet1!$A:$A,[Workbook2.xlsx]Sheet1!$B:$B,"Not Found"). Replace A2 with your identifier cell in Workbook1, $A:$A with the identifier column in Workbook2, and $B:$B with the column containing the data you want to retrieve. Use full paths if files are in different folders (e.g., ‘C:\Data\[Workbook2.xlsx]Sheet1’).
  4. Press Enter. If Workbook2 is closed, Excel prompts to open it—allow this to complete the link. Once closed, the formula still works if both files remain accessible in the same location.
  5. Drag the fill handle (small square at the cell’s bottom-right corner) down the column to apply the formula to all rows. Verify results: correct matches show values, while mismatches show “Not Found” (or whatever fallback text you included).
  6. To copy and paste values (breaking the link), select the column, press Ctrl+C, right-click the same column, choose “Paste Special” > “Values” > OK. This avoids broken links if Workbook2 moves or is renamed later.
  7. For a visual check, use conditional formatting: select your matched column, go to Home > Conditional Formatting > New Rule > Use a formula, enter =D2="Not Found", set fill color to light red, then OK. Highlighted rows indicate mismatches needing manual review.

Common Mistakes

  • Using partial matches without wildcards: XLOOKUP defaults to exact match. If identifiers have extra spaces (e.g., “ID123 ” vs “ID123”), use TRIM() in both datasets first.
  • Referencing entire columns incorrectly: Writing $A:$B instead of $A:$A for the lookup column returns wrong data. Always specify only the identifier column as the first range and the data column separately.
  • Ignoring case sensitivity: Excel’s match is case-insensitive. “ABC123” matches “abc123”—if case matters, use EXACT() with INDEX/MATCH instead.
  • Assuming data is sorted: XLOOKUP works with unsorted data, but older functions like VLOOKUP require sorted lookups for approximate matches. Stick to XLOOKUP for accuracy.
  • Not handling errors: Omitting the optional “if_not_found” argument shows #N/A errors. Always include a fallback like “Not Found” or blank (“”) to keep sheets clean.

Tips

  • Use named ranges for clarity: Select a column in Workbook2 (e.g., IDs), go to Formulas > Define Name, enter “IDs”, then reference it as IDs in XLOOKUP instead of $A:$A.
  • For large datasets, freeze panes (View > Freeze Panes) to keep header rows visible while scrolling through matches.
  • Test with a small sample (5–10 rows) before applying formulas to the full sheet to catch errors early.
  • Save both workbooks before running matches—Excel updates links on open, and unsaved changes might not reflect.
  • When working across workbooks, keep files in the same folder. Moving one breaks relative paths; absolute paths (e.g., C:\Data\) are safer for sharing.
  • For duplicate identifiers, XLOOKUP returns the first match. Use a secondary column (e.g., date) to refine uniqueness if needed.

Troubleshooting

If XLOOKUP returns #N/A: Confirm the identifier exists in Workbook2 by using Ctrl+F to search for the exact value (including spaces). If missing, check for hidden characters—select the cell, press F2, then Delete to re-enter the cell content.

If the formula shows as text (e.g., =XLOOKUP(...) displays literally), check cell format: right-click the cell > Format Cells > Number tab > General. Also ensure no leading apostrophe (’) precedes the formula.

If you see #REF! errors, verify Workbook2 hasn’t been moved, renamed, or deleted. Reopen it, then re-enter the formula path.

For “#NAME?” errors (common in older Excel versions), XLOOKUP may not be available. Use this alternative with INDEX/MATCH: =IFERROR(INDEX([Workbook2.xlsx]Sheet1!$B:$B,MATCH(A2,[Workbook2.xlsx]Sheet1!$A:$A,0)),"Not Found").

If links fail after closing workbooks, ensure both are stored on the same drive (e.g., local C: or OneDrive). For OneDrive/SharePoint, use the “Copy Link” > “Embed” feature to generate a stable path.

Frequently Asked Questions

Can I match data across sheets in the same workbook?

Yes—replace [Workbook2.xlsx]Sheet1! with Sheet2! in the formula (e.g., =XLOOKUP(A2,Sheet2!$A:$A,Sheet2!$B:$B)).

Does this work with Excel Online or mobile?

XLOOKUP works in Excel Online and mobile apps if your subscription includes it (Microsoft 365 Personal/Family/Business). Older free versions may lack XLOOKUP; use INDEX/MATCH instead.

How do I match multiple columns (e.g., ID + Date)?

Concatenate identifiers first: In Workbook1, add =A2 & "|" & TEXT(B2,"yyyy-mm-dd") in a helper column. Do the same in Workbook2, then match on the new combined column.

What if identifiers have different formats (e.g., text vs. numbers)?

Convert both to text using =TEXT(A2,"0") or force text with =VALUE(A2) for numbers. Then re-run the match.

Can I highlight only unmatched rows instead of listing “Not Found”?

Yes—apply conditional formatting to the entire row. Select all rows with data, use Home > Conditional Formatting > New Rule > Use a formula like =D2="Not Found", set fill color, then apply.

Will this update automatically if Workbook2 changes?

Yes—if both files are open, Excel refreshes matches on recalculation (F9). For closed workbooks, matches update when Workbook1 opens (if links are enabled under File > Options > Advanced > Update links to other documents).