How to Fix Mismatched Data When Merging Two Spreadsheets
The Problem: You Merge Two Spreadsheets and the Results Don't Add Up
You pull data from two systems, line everything up, and run your VLOOKUP or merge. Then you check the output and something's clearly wrong — rows are missing, figures don't match, or you end up with thousands more records than you started with. Sound familiar?
Mismatched data when merging spreadsheets is one of the most common — and most frustrating — problems in day-to-day data work. The good news is that the causes are almost always the same, and once you know what to look for, most of them are fixable in a few steps.
Why Spreadsheet Merges Go Wrong
Before you can fix mismatched data, you need to understand what's actually causing it. Most merge failures come down to one of four root causes:
- Trailing spaces or hidden characters — "A1234" and "A1234 " look identical on screen but are treated as different values.
- Inconsistent key formats — One sheet stores order IDs as ORD-001, the other stores them as 1. They won't match without transformation.
- Duplicate key values — If your matching column contains duplicates, a merge will multiply rows in ways you didn't intend.
- Mixed data types — A column that mixes text and numbers will cause lookups to silently fail on the rows where the type doesn't match.
The tricky part is that Excel and Google Sheets won't always warn you when these problems occur. Your formula will return a result — it just won't be the right one.
Step 1: Audit Your Key Columns Before Merging
The "key column" is the field you're using to match rows between the two sheets — typically something like an ID, reference number, or email address. This column is where most merge problems originate.
Start by checking these things in both sheets:
- Remove trailing and leading spaces. In Excel, wrap your key column in
=TRIM()and paste the result as values before merging. In Google Sheets, use=TRIM()in the same way. - Force a consistent data type. Select the key column, format it as either Text or Number (not General), and check for any cells that show a small green triangle in the corner — these are type mismatches Excel has flagged.
- Standardise the format. If one sheet uses ORD-001 and the other uses 001, you'll need to either strip the prefix from one or add it to the other. Use
=SUBSTITUTE(A2,"ORD-","")to remove a prefix, or="ORD-"&TEXT(A2,"000")to add a formatted one.
Step 2: Check for Duplicates in Both Sheets
If your key column contains duplicate values, a merge won't just fail — it will silently multiply. A one-to-many relationship becomes a many-to-many, and suddenly you have three times the rows you expected.
To check for duplicates in Excel:
- Select your key column.
- Go to Home → Conditional Formatting → Highlight Cell Rules → Duplicate Values.
- Any highlighted cells need to be resolved before you merge.
Ask yourself: should this key be unique in this sheet? If it's a reference number or ID, the answer is almost always yes. If duplicates exist, find out why — they may represent genuine data problems that need fixing upstream, not just in the spreadsheet.
Step 3: Do a Pre-Merge Row Count Check
Before you run any merge or lookup, record the row counts of both source sheets. After the merge, your output row count should be predictable based on the type of join you're doing:
- Inner join (only matching rows): Output should be less than or equal to the smaller sheet.
- Left join (all rows from Sheet 1, matched where possible): Output should equal Sheet 1's row count.
- Full join (all rows from both): Output could be as large as both sheets combined.
If your output is significantly larger than expected, you almost certainly have duplicate keys. If it's much smaller than expected, your keys aren't matching — go back to Step 1.
Step 4: Find the Rows That Didn't Match
When a VLOOKUP or merge fails silently, you get #N/A errors or blank cells where values should be. Don't just delete these — investigate them. They're telling you something important.
To isolate unmatched rows:
- Add a helper column with a VLOOKUP or MATCH formula referencing the second sheet.
- Filter for
#N/Aresults. - Manually compare a few of the unmatched keys side by side — copy them into a cell and use
=EXACT(A2,B2)to test for exact character-level differences, including hidden spaces and case mismatches.
In many cases, you'll find the problem instantly. A reference that looks like ABC123 in one sheet is abc123 in the other. Use =UPPER() or =LOWER() to normalise case before matching.
Step 5: Validate the Merged Output
Once you've done the merge, don't assume it's correct. Run a few quick validation checks:
- Spot-check rows manually. Pick five to ten records and verify the merged data looks right against the source sheets.
- Check totals. If you're merging financial or quantity data, sum a key column before and after. The total shouldn't change unless you've intentionally excluded rows.
- Count blank cells. Use
=COUNTBLANK()on columns that should be fully populated. Any blanks in a mandatory field indicate a failed match.
When the Problem Is the Process, Not Just the Data
If you're doing this kind of merge regularly — pulling from two or more systems, cleaning keys, validating outputs — you'll know that fixing it once doesn't stop it happening again next month. The same mismatches reappear because the underlying process is manual.
Tools like Smart Data Blender are built specifically for this kind of repeatable data combining and validation work. Rather than rebuilding your cleanup steps every time, you define the logic once and run it against each new data extract — catching mismatches automatically before they make it into your reports.
That said, the steps above will fix most one-off merge problems without any additional tooling. The key is being methodical: audit your keys, check for duplicates, validate your output, and never trust a merge you haven't spot-checked.
Quick Reference: Merge Mismatch Checklist
- ☐ Trim whitespace from key columns in both sheets
- ☐ Force consistent data types (text or number, not mixed)
- ☐ Standardise key format (prefixes, leading zeros, case)
- ☐ Check for and resolve duplicate keys
- ☐ Record source row counts before merging
- ☐ Filter for unmatched rows and investigate with
=EXACT() - ☐ Spot-check output and verify column totals
Work through that list before every merge and you'll catch the vast majority of problems before they cause downstream errors in your reports.
Tired of doing this by hand?
Smart Data Blender does it automatically, in one click. Free trial, no card needed.
Try Smart Data Blender free