Matching data between two Excel sheets is straightforward once you know how to align columns, apply formulas, or use built-in tools. This works for consolidating lists, merging records, or finding duplicates—whether you’re comparing inventory, customer records, or financial reports. You’ll only need your Excel software (Excel 2016+ or Google Sheets) and patience for a few clicks or keystrokes. The key is identifying matching keys (like IDs or names) and using conditional logic to link corresponding rows.

What You'll Need

  • A copy of Microsoft Excel (2016 or later) or Google Sheets
  • Two open Excel files—Sheet A (your source data) and Sheet B (the target or reference data)
  • Matching criteria: a common column (e.g., "Employee ID", "Product Name") to pull data from one sheet into another
  • Basic familiarity with Excel functions (VLOOKUP, INDEX-MATCH, or CTRL+D for auto-fill)
  • Optional: Power Query (Excel’s built-in data transformation tool) or Google Sheets’ "Data > Merge Rows" feature

Step-by-Step

  1. Choose a matching key:
    • Open both files side by side. Inspect Sheet A and Sheet B for a column with identical values across rows—this will be your "key" (e.g., "Product Code", "Client Number"). Avoid strings (like names) if precision is critical; numeric or alphanumeric keys work best. Label this column in Sheet A as "Match Key" for clarity.
    • Example: If Sheet A has "Product ID" and Sheet B has "Product Code", ensure both columns contain the same values for matching. Some fields (like dates) may need formatting adjustments (e.g., "MM/DD/YYYY" vs. "DD-MMM-YY").
  2. Method A: Manual Copy-Paste with Formulas (Best for simple 1:1 matches)
    1. In Sheet B, select the next column (e.g., "Details") where you’ll paste data from Sheet A. For example, if Sheet A’s "Product Name" is in Column D, drag Column E in Sheet B to the right.
    2. Copy the entire range of matching keys from Sheet A (e.g., select Columns B:B in Sheet A). Paste them into Sheet B’s column for the same key (e.g., Column B in Sheet B).
    3. In the target column (e.g., Column E in Sheet B), use a formula to pull data from Sheet A: =IFERROR(INDEX(A:Z, MATCH(B2, A:A, 0)), "") Replace A:Z with Sheet A’s range (e.g., D:D for "Product Name") and B2 with the key cell in Sheet B. Drag the formula down to apply it to all rows.
    4. If keys don’t exist in Sheet B, use IFERROR to return an empty cell instead of an error. For multiple columns in Sheet A, adjust the formula to reference each field separately.
    Note: This requires exact matches. For partial matches (e.g., "John" vs. "John D."), use IFERROR(INDEX(...), SEARCH(...)) or Google Sheets’ FILTER function.
  3. Method B: VLOOKUP (Excel-only, for exact matches)
    1. Select the cell where you’ll display Sheet A’s data in Sheet B (e.g., E2). Enter: =VLOOKUP(B2, SheetA!A:Z, 4, FALSE) Replace B2 (key cell) with your key column, SheetA!A:Z (Sheet A’s range), and 4 (column number of the data you want to pull).
    2. Drag the formula down. For exact matches, use FALSE (exact match) instead of 0 (approximate).
    3. If keys are in different columns or formats, adjust the range (e.g., SheetA!D:D for "Product Name" instead of Column A).
    Limitations: VLOOKUP is less flexible than INDEX-MATCH for complex queries. For partial matches or non-contiguous ranges, use INDEX-MATCH: =INDEX(SheetA!D:D, MATCH(B2, SheetA!A:A, 0), 1) (Reference the same key column and adjust the second 1 to pull the desired data column.)
  4. Method C: Power Query (Excel’s advanced tool)
    1. In Excel, go to Data > Get & Transform > From Table/Range to load Sheet A’s data into Power Query. Repeat for Sheet B.
    2. In Power Query for Sheet A, rename the key column (e.g., "Match Key"). In Sheet B’s query, rename its key column similarly.
    3. Merge the two queries on the match key:
      1. Right-click the key column in Sheet A’s query > Merge Queries > Sheet B’s query.
      2. Select the key columns and click Duplicate columns to keep both keys.
      3. Expand the merged columns to show all data from both sheets.
    4. Load the merged data back into a new sheet. Power Query handles mismatches automatically (e.g., empty cells for unmatched keys).
    Power Query is best for large datasets or when you need to transform data before merging.
  5. Method D: Google Sheets (Merge Rows)
    1. Open both sheets in Google Sheets. In Sheet B, select the column where you want to pull data from Sheet A (e.g., Column E).
    2. Go to Data > Merge Rows > Merge All. Choose Match Existing Entries Only if exact matches are required.
    3. Enter the key column (e.g., Column B in Sheet B) as the "Merge Key". Select the corresponding column in Sheet A (e.g., Column A).
    4. Click Merge. Google Sheets will fill Sheet B’s target column with matching data from Sheet A. For partial matches, use Merge with Partial Matches.
    Google Sheets’ merge is simpler than Excel’s INDEX-MATCH but less flexible for advanced queries.
  6. Verify results:
    1. Check for empty cells or errors (e.g., #N/A) in Sheet B’s merged data. Use IFERROR or Power Query’s merge settings to handle missing matches.
    2. Compare a sample of rows manually to confirm accuracy. If keys are numeric or alphanumeric, ensure formats match (e.g., "123" vs. "00123").
    3. For duplicates, use Excel’s COUNTIF or SUMIF to check frequency: =COUNTIF(SheetA!A:A, B2) (Replace the range with your key column and Sheet A’s data range.)

Common Mistakes

  • Using wrong key columns: Ensure the key columns in both sheets are identical in format (e.g., "ID" vs. "ID#"). A mismatch will break all matches.
  • Ignoring case sensitivity: Excel’s VLOOKUP is case-sensitive by default. For case-insensitive matches, use VLOOKUP(B2, SheetA!A:Z, 4, TRUE) (replace TRUE with FALSE for exact matches).
  • Skipping formula validation: Always test formulas with a small subset of data. Use IFERROR to avoid blank screens or errors.
  • Overlooking data formatting: Dates, currencies, or percentages must match exactly (e.g., "1/1/2024" vs. "01-Jan-24"). Convert formats if needed (e.g., use TEXT or VALUE functions).
  • Assuming partial matches work: Google Sheets’ "Merge with Partial Matches" is forgiving, but Excel’s methods require exact matches for reliability.

Tips

  • Pre-filter data: Use Excel’s FILTER function or Google Sheets’ "Filter" feature to narrow Sheet A to only rows with keys you want to match before merging.
  • Save as a template: Create a template with standard columns and formulas to reuse across projects.
  • Use conditional formatting: Highlight mismatched keys in Sheet B with a green/red color scale (e.g., =IFERROR(...) with conditional formatting rules).
  • Automate with macros (Excel only): For repetitive tasks, record a macro that runs your VLOOKUP or INDEX-MATCH logic. Insert the macro via Developer > Record Macro.
  • Test with dummy data: Start with placeholder data (e.g., "ID1", "Product X") to debug formulas before using real data.
  • Leverage helper columns: Add a temporary column in Sheet B to log key values before merging (e.g., "Key Collected: =B2"). This helps visualize the matching process.

Troubleshooting

  1. Formula errors (#N/A or #VALUE!):
    • Check that the key column in Sheet B exists in Sheet A’s data range. For example, if your formula is =VLOOKUP(B2, SheetA!A:Z, 4, FALSE), ensure Column 4 (data column) in Sheet A includes the field you’re querying (e.g., "Product Name").
    • If keys are text but formatted differently (e.g., "John" vs. "JOHN"), use =LOWER(B2) in Sheet B’s key column before merging or adjust Sheet A’s key to match formatting.
    • For partial matches, use =SEARCH(B2, SheetA!A:A) instead of MATCH.
  2. Data not merging:
    • Verify the key columns are aligned. For example, if Sheet A’s key is in Column A and Sheet B’s key is in Column C, adjust your formula to reference the correct range (e.g., =VLOOKUP(C2, SheetA!A:Z, 4, FALSE)).
    • Check for hidden rows or formatting differences (e.g., merged cells). Select the entire range before copying data to avoid hidden columns.
    • If using Power Query, ensure the merge step isn’t blocked by mismatched data types (e.g., a key column in Sheet A is numeric while Sheet B’s is text).
  3. Slow performance:
    • For large datasets (>10,000 rows), avoid VLOOKUP. Use INDEX-MATCH or Power Query, which are more efficient.
    • In Excel, add an index to your formulas (e.g., =INDEX(SheetA!D:D, MATCH(B2, SheetA!A:A, 0), 1)) to speed up lookups.
    • Disable macros or reduce add-ins temporarily to rule out conflicts.
  4. No matches found:
    • Manually verify a few rows. A blank Sheet B means keys in Sheet A don’t exist in Sheet B’s key column. Add a helper column to log this (e.g., "Match Status: =IFERROR(...)" to show "Yes" or "No").
    • For partial matches, use =IF(ISNUMBER(MATCH(...)), "Match", "No") to flag results.

Frequently Asked Questions

How do I match data between two sheets if the keys are in different columns?

Use a helper column in Sheet B to log the key values before merging. For example, add a column labeled "Key Lookup" and use a formula like =B2 (the key from Sheet B). Then reference this helper column in your VLOOKUP or INDEX-MATCH formula instead of Sheet B’s original key column.

What if my data has duplicates in the key column?

Power Query or Google Sheets’ merge will handle duplicates automatically by keeping all occurrences. In Excel, use a formula with IFERROR to ensure only the first match is displayed (or use a helper column to list all matches). To count duplicates, use =COUNTIF(SheetA!A:A, B2) in Sheet B.

Can I merge data if the key columns have different names?

Yes, but you’ll need to rename or adjust the formulas. In Power Query, rename the columns to match in both queries. In Excel, use a helper column to map names (e.g., =IF(A2="Product ID", "KeyCol", "")) and reference that column in your formula.

How do I merge data if Sheet B has more rows than Sheet A?

Your formula or merge will return blank cells for unmatched keys. Use IFERROR in Excel or enable "Merge with Partial Matches" in Google Sheets to show partial results. For a clean output, filter Sheet B to only rows with valid keys first.

What if I need to merge columns rather than just matching rows?

Use a combination of methods: copy the key column from Sheet A to Sheet B, then merge each data column separately. For example, for "Product Name": =IFERROR(INDEX(SheetA!D:D, MATCH(B2, SheetA!A:A, 0), 1), "") Repeat for each data column in Sheet A.

Can I automate this process for recurring tasks?

Yes. In Excel, record a macro that runs your VLOOKUP or INDEX-MATCH logic. In Google Sheets, use scripts (via Extensions > Apps Script) to automate merges with custom functions. For Power Query, save the merged dataset as a template.