How to Merge Two Excel Sheets by a Common Column
You have one list with order IDs and another with customer names, and you want them side by side. The trick is a shared column, like an ID or an email address, that appears in both lists. Here are three ways to merge on it.
Method 1: XLOOKUP or VLOOKUP
Add a new column next to your main list and look up each ID in the second sheet.
=XLOOKUP(A2, Customers!A:A, Customers!B:B, "Not found")
On an older version of Excel, VLOOKUP does the same job: =VLOOKUP(A2, Customers!A:B, 2, FALSE). Drag the formula down the column. Our VLOOKUP guide explains each part.
Method 2: Power Query
- Select your first table and choose Data → From Table/Range. Do the same for the second table.
- In the Power Query editor choose Home → Merge Queries.
- Pick both tables and click the matching column in each.
- Choose Left Outer as the join type to keep every row of the first table.
- Expand the new column to pick the fields you want, then choose Close & Load.
It takes longer to set up, but it copes well with big tables and can be refreshed when the data changes.
Method 3: A tool with no formulas
In DataGenius BI, upload your main file and open Match & Merge. Pick the second file, choose the matching column in each, tick the columns to bring over and press Merge into my data. It keeps every row of your main file, uses the first match it finds, ignores capital letters and extra spaces, and tells you how many rows were not found. The Restore original button undoes it.
Why some rows do not match
- Extra spaces: "A102 " and "A102" look the same but are different.
- Different formats: "A-102" and "A102".
- Numbers stored as text in one list and as real numbers in the other.
- Duplicates in the second list. Lookups only use the first match.
- The value really is missing from the second list.
Check before you trust the result
Count your rows before and after. With a lookup, the row count stays the same. In Power Query, duplicate keys in the second table create extra rows, so compare the totals and look for repeats if they differ.
Common questions
What if the common column is spelled differently in the two sheets?
Rows will not match. Clean both columns first, with the same capitals and no extra spaces, and check that one file does not hold numbers saved as text.
What does #N/A mean after a lookup?
The value was not found in the other sheet. Check for spaces, spelling, and a mix of numbers and text.
Does merging change my original files?
No. Merging creates a new table, so your original files stay as they are.
Related guides
Check its quality score and clean it in your browser. Free, no signup, and your file is never uploaded.
Try DataGenius BI