Excel Practice Test

โ–ถ

Merge Methods at a Glance

โšก
5
Reliable Methods
๐Ÿงฑ
M365
VSTACK Needed
๐Ÿ“‚
10+
Files? Use PQ Folder
๐Ÿ”‘
1
Common Key Column

How to Merge Two Excel Spreadsheets โ€” Complete Guide (2026)

Short answer: there's no single "merge" button in Excel. The right way depends on what you mean. Stacking rows? Joining on a key? Pulling one column across? Each needs a different tool.

This guide walks through five methods that actually work, plus what to skip. You'll see when Power Query beats VLOOKUP, when plain copy and paste is fine, and the one trick that only works in merge cells in excel situations (it's not what most beginners think).

Worth knowing: "merge" inside Excel's ribbon means joining cells visually. That's almost never what you want when combining two spreadsheets. For real data combining โ€” pull rows from File A and File B into one clean dataset โ€” you need Power Query, a lookup formula, or the new dynamic array functions. The ribbon's Merge & Center button is for layout. It's not a data tool.

Here's the thing: if both files share a common column (Customer ID, SKU, Date), you can join them. If they share the same column structure, you can stack them. If they share nothing, you're back to manual paste. Identify which scenario you're in before opening anything. Spending two minutes on this decision saves the wrong-tool spiral that costs an hour.

The honest answer: most people overcomplicate this. A 200-row merge with a shared key takes three minutes in excel merge tables Power Query. A formula version takes ten. A copy-paste-and-pray version takes thirty minutes and breaks the second the source data changes.

One more thing before the methods. Always work on a copy. Always. The first merge attempt fails about half the time โ€” wrong join kind, mismatched headers, dates that look right but aren't. Save File A as File A-merged before touching anything. You'll redo it at least once.

Quick Method Picker

Pick the method that matches what you're trying to do. Each card tells you the scenario, the trade-off, and when to skip it.
โšก Power Query โ€“ Most Powerful

Best for repeatable joins, 1,000+ rows, or folder-level merges. Refreshable. Learning curve.

  • Use when: Joining by key, or combining 10+ files
  • Excel version: 2016+ (all editions)
๐Ÿ”Ž VLOOKUP / XLOOKUP โ€“ Formula

Best for pulling one or two columns from File B into File A. Lives in cells, breaks if columns move.

  • Use when: Adding 1โ€“3 columns, small dataset
  • Best version: XLOOKUP (Excel 2021+)
๐Ÿ“‹ Copy and Paste โ€“ Quick

Manual, fast for one-off jobs under 500 rows. No refresh. Easy to mess up.

  • Use when: One-time merge, identical columns
  • Watch out: Paste Special โ†’ Values to drop formats
๐Ÿ“Š Consolidate โ€“ Summary Only

Built-in tool for SUM, AVG, COUNT across sheets. Not a true row merge โ€” it aggregates.

  • Use when: You want totals, not raw rows
  • Location: Data tab โ†’ Consolidate
๐Ÿงฑ VSTACK / HSTACK โ€“ M365 Only

Dynamic array functions. Spill stacked or side-by-side ranges across sheets. Live, recalculates.

  • Use when: Microsoft 365 / Excel 2024
  • Bonus: Combine with LAMBDA for reusable merges
๐Ÿ’ป VBA Macro โ€“ Advanced

Workbooks.Open + Range.Copy. For scheduled jobs or repeatable file-level merges.

  • Use when: Same merge runs weekly/monthly
  • Skill: Comfortable with Alt+F11
Append vs Merge โ€” They're Not the Same

Append stacks rows from File B underneath File A. Both files need the same column structure (Name, Email, Date). End result: more rows, same columns.

Merge joins File B's columns onto File A's rows using a shared key (like Customer ID). End result: same rows, more columns.

If you say "merge" but actually need to stack rows, you'll waste an hour trying to build a join. Identify which one you need before opening Power Query โ€” the menu literally asks you to choose Append or Merge as separate options.

Method 1 โ€” Power Query (the Best Option for Most Cases)

Power Query is built into Excel 2016 and later. It lives under Data โ†’ Get Data. It's free. It refreshes. It handles a million rows. And once you build a query, you can refresh it every Monday morning without rebuilding anything.

Step-by-step: combine two files

Open File A. Go to Data โ†’ Get Data โ†’ From File โ†’ From Workbook. Pick File B. In the Navigator pane, select the sheet you need. Click Transform Data (not Load โ€” Load drops it straight into a sheet without cleanup).

The Power Query Editor opens. Now do the same for File A: Home โ†’ Recent Sources or repeat the Get Data flow. You'll have two queries listed on the left.

Right-click File A's query. Pick Append Queries as New if you want stacked rows. Pick Merge Queries as New if you want a join on a key column. Excel walks you through column matching either way.

For Merge: select the key column in both tables. Choose join kind (Left Outer keeps all rows from File A, Inner keeps only matches). Click OK. Expand the new column to pull in fields from File B.

Click Close & Load. Excel drops the combined data into a new sheet as a refreshable table. Right-click the table and pick Refresh to pull updated data from the source files. Worth knowing: this is closely related to how to merge spreadsheets in excel using Power Query's Append feature.

Combining 10+ files from a folder

This is where Power Query shines. Data โ†’ Get Data โ†’ From File โ†’ From Folder. Point at the folder holding your files. Excel reads every .xlsx inside, lets you pick which sheet to grab from each, and stacks them into one table. Add a new file to the folder โ†’ click Refresh โ†’ it appears in your combined dataset. No formulas, no copy-paste.

Power Query: Append vs Merge in Detail

๐Ÿ”— Append (stack rows)

What it does: Adds File B's rows below File A's rows. Columns must match โ€” same names, same data types.

When to use: Monthly sales files, daily exports, multi-region CSVs with identical structure. Stacking January + February sales into one annual table is a classic Append job.

Watch out for: Mismatched column names ("Customer Name" vs "customer_name") create separate columns instead of merging them. Rename in Power Query first, then Append.

๐Ÿ”‘ Merge (join on key)

What it does: Matches rows between File A and File B using a shared key (Customer ID, Email, Order Number). Pulls File B's columns onto File A's rows.

When to use: Adding customer details from CRM to order data. Pulling product specs into a sales report. Linking employee IDs to payroll info.

Join kinds: Left Outer (keep all File A, match where possible โ€” most common). Inner (only matched rows). Full Outer (everything, blanks where no match). Anti (rows in A that have no match in B โ€” useful for finding gaps).

๐Ÿ“‚ Folder combine

What it does: Reads every file in a folder, extracts the same sheet from each, stacks the rows. Auto-detects new files on refresh.

When to use: Monthly reports dropped into one folder. Regional sales exports from 12 stores. Year-end aggregation of weekly logs.

Setup: Data โ†’ Get Data โ†’ From File โ†’ From Folder. Pick folder. Click Combine. Excel creates a sample query, a helper function, and the final combined table โ€” all automatically.

๐Ÿ”„ Refresh strategy

Right-click table โ†’ Refresh: pulls latest data from source files. Only works while source files exist at the same path.

Auto-refresh on open: Query Properties โ†’ "Refresh data when opening the file." Useful for dashboards.

Background refresh: on by default. Turn off if you need the refresh to finish before macros run on the result.

Start FREE Excel Functions Questions and Answers

Method 2 โ€” VLOOKUP and XLOOKUP for Pulling Columns Across

If you only need one or two columns from File B added to File A, skip Power Query. A formula does it faster โ€” and lives right in the cell where you can see it.

VLOOKUP (works in every Excel version)

Syntax: =VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

Real example: File A has Customer ID in column A. File B has Customer ID in column A and Email in column D. To pull emails into File A's column E:

=VLOOKUP(A2, '[FileB.xlsx]Sheet1'!$A:$D, 4, FALSE)

Breaking that down: A2 is the Customer ID to look up. '[FileB.xlsx]Sheet1'!$A:$D is the range in File B (keep File B open while building the formula or save it locally first). 4 is the column number to return (Email is the 4th column). FALSE means exact match only โ€” never use TRUE unless you really know why.

XLOOKUP (Excel 2021 and Microsoft 365)

XLOOKUP fixes everything wrong with VLOOKUP. It searches left, right, returns multiple columns, handles errors with a fourth argument, and doesn't break when you insert a new column in the source.

Same example with XLOOKUP:

=XLOOKUP(A2, '[FileB.xlsx]Sheet1'!$A:$A, '[FileB.xlsx]Sheet1'!$D:$D, "Not found")

Cleaner. The fourth argument ("Not found") replaces IFERROR wrappers. And if someone inserts a column between A and D in File B, the formula still works โ€” it references the Email column directly, not column number 4.

Fair warning: lookups reference external workbooks. If File B moves, gets renamed, or someone closes it without you converting the formulas to values first, you'll see #REF! errors everywhere. For long-term merges, switch to Power Query. For quick one-offs, lookups are fine. This is similar to how you'd approach how to merge in excel for cell-level joins, just at column scale.

Power Query vs Formula Lookups

Pros

  • Refreshable โ€” one click pulls new source data
  • Handles millions of rows without slowdown
  • Builds repeatable joins you can reuse next month
  • Cleans data on the way in โ€” trim, type, rename
  • Works on folder-level combines (10+ files)
  • No #REF! errors from moved columns

Cons

  • Lives in a cell โ€” easier to debug visually
  • No editor to learn โ€” type and go
  • Faster for tiny one-time merges (under 50 rows)
  • Works in every Excel version since 2007
  • Easy to share via the source file alone
  • Doesn't require external query connection setup

Method 3 โ€” Copy and Paste (Yes, Sometimes It's the Right Answer)

Don't dismiss this. For a one-shot job under 500 rows where both files have identical column structure, copy-paste beats every other method on speed. Three steps and done.

The clean way to do it

Open File B. Select the data rows (not headers, unless File A is empty). Ctrl+C. Switch to File A. Click the first empty cell below your existing data. Right-click โ†’ Paste Special โ†’ Values. Done.

Why Paste Special โ†’ Values? Direct paste brings formats, conditional formatting, formulas, and named ranges along for the ride. Values-only paste leaves File A's existing formats clean and dumps in just the data.

If both files have headers but different column orders, sort one before pasting. Or use Power Query โ€” at that point you're past the simple paste threshold.

When paste goes wrong

Three failures keep showing up. One: dates pasted as text because regional settings differ. Fix: paste into a temp column, then =DATEVALUE() the column, paste-as-values back. Two: numbers showing as text (left-aligned with a green triangle warning). Fix: multiply the range by 1, or use Text to Columns โ†’ Finish. Three: hidden rows in the source. Selecting visible rows only: hold Alt+; (semicolon) before copying. That selects only visible cells.

Bottom line: paste works. But the moment you'd run the same merge a second time, switch to Power Query. Paste is a one-shot tool.

Pre-Merge Data Cleanup Checklist

Both files have headers in row 1 โ€” no blank rows above headers
Key column has no leading/trailing spaces (use TRIM if unsure)
Key column has identical data types (all text, or all numbers โ€” not mixed)
Dates use the same format across both files (or convert with DATEVALUE)
Duplicate keys identified โ€” Power Query will multiply rows on duplicates
No merged cells in the source range (literal Excel "merge cells" feature)
Numbers stored as numbers, not text (check for green triangle warnings)
Column names match exactly if appending (case-sensitive in Power Query)
Saved both files before starting โ€” Power Query may lock files briefly
Backup of File A made โ€” first merge attempts often need a redo

Method 4 โ€” Consolidate (for Summary Totals, Not Raw Rows)

Consolidate is the most misunderstood tool in Excel. It's not a row-level merge. It's an aggregator. If you have January sales in Sheet1 and February sales in Sheet2, Consolidate creates a Sheet3 showing the SUM per product across both months. Raw rows? Not preserved. Just the totals.

When to use it

Monthly budget files where each tab has the same row labels (Q1 expenses, Q2 expenses, etc.) and you want totals. Sales by region across separate workbooks. Multiple locations reporting in the same template โ€” Consolidate aggregates by row label.

How it works

Open a blank sheet (this is where the summary lands). Data tab โ†’ Consolidate. Pick a function (Sum, Average, Count, Max, Min). Add each source range one by one โ€” they can be on different sheets or in different files. Check "Top row" and "Left column" if both files have matching headers and labels. Click OK.

The result: a new table with unique row labels and aggregated values. Consolidate matches on label name, so "Office Supplies" in File A and "office supplies" in File B will create two separate rows. Standardize labels first.

Why it's not what most people want

If you ask 100 Excel users "how do I merge two files," maybe 5 actually want Consolidate. The other 95 want stacked rows or column joins โ€” and Consolidate doesn't do either. It silently aggregates and throws away row-level detail. That's a feature, not a bug, but only if you actually wanted aggregation. For comparing aggregated values to mail merge excel workflows (which aggregate contact lists differently), the logic is similar but the destination is different.

Method Trade-offs โ€” Speed vs Power

โšก
3 min
Power Query (Append)
First-time setup. Refresh in seconds after that.
๐Ÿ”Ž
5 min
VLOOKUP Setup
Per file. Adds 1 column at a time. Breaks on moves.
๐Ÿ“‹
2 min
Copy-Paste Values
One-shot only. No refresh. Under 500 rows ideal.
๐Ÿ“Š
4 min
Consolidate
Summary totals only โ€” not raw row merge.
๐Ÿงฑ
1 min
VSTACK Formula
M365 only. Live-recalculates. =VSTACK(A:D, Sheet2!A:D).
๐Ÿ’ป
20 min
VBA Macro
Setup heavy. Free after that for scheduled jobs.

Method 5 โ€” VSTACK and HSTACK (Microsoft 365 Only)

VSTACK and HSTACK landed in Microsoft 365 around 2022. They're dynamic array functions โ€” meaning you type one formula in one cell, and Excel spills the result across as many cells as the data needs.

VSTACK basics

Syntax: =VSTACK(array1, array2, ...)

Stacks ranges vertically. If Sheet1 has data in A1:D100 and Sheet2 has data in A1:D80, the formula:

=VSTACK(Sheet1!A1:D100, Sheet2!A1:D80)

...spills 180 rows of combined data wherever you typed it. Live. Edit Sheet1, the merged view updates instantly.

HSTACK for side-by-side

Same idea, horizontal. =HSTACK(Sheet1!A1:A100, Sheet2!A1:A100) puts two columns next to each other in one spill. Useful for quick comparisons before you commit to a real merge.

LAMBDA combos for reusable merges

If you're stacking files weekly, wrap VSTACK in LAMBDA to build a reusable function. Name it MergeFiles in Formulas โ†’ Name Manager. Then =MergeFiles(Range1, Range2, Range3) works as a custom function. Not for beginners, but for power users it kills repetitive merge work.

The catch

VSTACK and HSTACK only exist in Microsoft 365 and Excel 2024. Excel 2019, 2021 perpetual, or anything older won't recognize them โ€” they'll throw #NAME? errors. Check File โ†’ Account: if it says "Microsoft 365 Apps," you're set. Anything else, fall back to Power Query.

VBA and Power Automate (For Scheduled Merges)

For merges that run on a schedule โ€” every Monday at 8 AM, or whenever a new file lands in a SharePoint folder โ€” formulas and manual Power Query refreshes aren't enough. You need automation.

VBA basics

Press Alt+F11 to open the VBA Editor. Insert โ†’ Module. Paste a macro that opens File B, copies the data range, and pastes it into File A. The skeleton:

Sub MergeFiles()
  Workbooks.Open "C:\path\to\FileB.xlsx"
  Workbooks("FileB.xlsx").Sheets(1).Range("A2:D1000").Copy
  ThisWorkbook.Sheets(1).Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
  Workbooks("FileB.xlsx").Close False
End Sub

Run it with a button or the Macro dialog (Alt+F8). For scheduled runs, use Windows Task Scheduler to launch Excel with the file and trigger the macro via command-line arguments.

Power Automate for file-level merges

If your files live in SharePoint, OneDrive, or Teams, Power Automate is cleaner than VBA. Build a flow: When a file is created in folder โ†’ Run Office Script โ†’ Append data to master file. No VBA, runs in the cloud, works whether your machine is on or off. Office Scripts (the cloud cousin of VBA) handle the copy/paste piece.

Power Query Workflow โ€” Start to Refreshable Merge

๐Ÿ“‚

Save both files to a stable location. Don't move or rename them after building the query โ€” Power Query stores the path.

โšก

Data tab โ†’ Get Data โ†’ From File โ†’ From Workbook. Repeat for File B. Both queries appear in the Queries pane.

๐Ÿ”€

Append for stacking rows (same columns). Merge for joining on a key column. Different menu items โ€” pick the right one upfront.

๐Ÿ”‘

For Merge: pick key columns, pick join kind (Left Outer is the safest default). For Append: confirm column names match exactly.

๐Ÿงน

Click the expand icon on the merged column to pull in fields. Rename columns, set data types (text/number/date), remove unused columns.

๐Ÿ’พ

Home โ†’ Close & Load. Excel drops the result into a new sheet as a refreshable table. You're done โ€” click Refresh anytime to pull updates.

๐Ÿ”„

Right-click table โ†’ Properties โ†’ check 'Refresh data when opening the file' for daily auto-refresh.

Start FREE Excel Formulas Questions and Answers

Common Errors and How to Fix Them

Five errors keep showing up every time someone merges two Excel spreadsheets. Knowing them in advance saves an afternoon of head-scratching. Each one has a specific symptom, a clear cause, and a fix that takes under a minute once you've seen it before.

Duplicate column headers after Append

Symptom: appending creates "Email" and "Email.1" instead of one Email column. Cause: column names don't match exactly across files โ€” case, spaces, or hidden characters. Fix: rename columns to lowercase, trimmed versions in both queries before appending. Power Query โ†’ right-click column โ†’ Rename. Or use the Transform tab's Format โ†’ Trim and Format โ†’ lowercase to normalize automatically.

Mismatched data types

Symptom: numbers showing as #VALUE! after merge, or dates appearing as 5-digit numbers like 45291. Cause: one file stored a column as text, the other as a number or date. Excel treats the merged column as text by default, which breaks every downstream formula. Fix: in Power Query, change column types explicitly (Transform tab โ†’ Data Type). Whole Number, Decimal, Date, Text. Set the type BEFORE clicking Close & Load.

Merge key missing or with nulls

Symptom: many rows after Merge show null values in the new columns. Cause: the key column has missing or mismatched values, or the join kind was wrong. Fix: before merging, filter out nulls on the key column in both queries. Power Query โ†’ click filter icon on key column โ†’ uncheck (null). For partial matches (where some rows have no counterpart in File B), switch the join kind to Left Outer โ€” that keeps every File A row and just leaves the new columns blank where no match exists.

Power Query can't find the file

Symptom: Refresh throws "DataSource.Error: Could not find file." Cause: source file moved or renamed. Power Query stores the absolute path at build time, so any move breaks the link. Fix: Power Query Editor โ†’ Advanced Editor โ†’ update the file path in the M code, OR delete the query and rebuild from the new path. Better long-term fix: use OneDrive or SharePoint URLs โ€” they survive folder restructuring on the local disk.

#REF! errors after lookup formulas

Symptom: VLOOKUP formulas show #REF! after closing the source file. Cause: external workbook reference broke. Fix: convert the formula results to values (Copy โ†’ Paste Special โ†’ Values) before the source file is moved or deleted. Or switch to Power Query for permanent links โ€” its file path is stored once and the data lives in the destination workbook. For more Excel troubleshooting, the excel reference page has the full error code list and recovery steps for each one.

Start FREE Excel Questions and Answers

Excel Questions and Answers

What's the Easiest Way to Merge Two Excel Spreadsheets?

For one-time jobs under 500 rows with identical columns, copy-paste using Paste Special โ†’ Values is the easiest. For anything you'll repeat, Power Query (Data โ†’ Get Data โ†’ From File) is the right tool โ€” set up once, refresh forever.

How Do I Merge Two Excel Spreadsheets by Common Column?

Use Power Query's Merge feature. Data โ†’ Get Data โ†’ From File for both files. In the Queries pane, right-click one query โ†’ Merge Queries as New. Select the shared key column in both tables, pick Left Outer Join (keeps all rows from the first file), expand the new column to pull in the matched fields. Refreshable forever.

Can I Merge Excel Sheets Without Losing Data?

Yes โ€” but only if you use a non-destructive method. Power Query and VLOOKUP/XLOOKUP both leave source files untouched. Direct copy-paste can overwrite cells if you paste into the wrong location. Always make a backup of the destination file first, and use Paste Special โ†’ Values to avoid overwriting formats.

How Do I Combine 10 or More Excel Files?

Power Query's Combine Files feature. Drop all files into one folder. Data โ†’ Get Data โ†’ From File โ†’ From Folder. Point at the folder, pick the sheet to extract, click Combine. Excel reads every .xlsx, stacks the data, and gives you one refreshable table. Adding a new file to the folder auto-includes it on next refresh.

What's the Difference Between Append and Merge in Power Query?

Append stacks rows from File B underneath File A โ€” same columns, more rows. Use it when both files have identical structure (monthly sales, weekly logs). Merge joins File B's columns onto File A's rows using a shared key โ€” same rows, more columns. Use it for adding lookup data (customer details, product specs).

Why Do My VLOOKUP Formulas Break After Closing the Source File?

Closed-workbook lookups stop working when the source file moves, renames, or is deleted. To prevent this, either keep both files in the same folder with a fixed path, or convert lookup results to static values (Copy โ†’ Paste Special โ†’ Values) before closing. For long-term setups, switch to Power Query โ€” it stores the file path internally and only loads data on refresh.

Does Excel 2019 Have VSTACK and HSTACK?

No. VSTACK and HSTACK are Microsoft 365 and Excel 2024 only. Excel 2019, 2021 perpetual, and earlier versions throw #NAME? errors. Check File โ†’ Account โ€” if it doesn't say "Microsoft 365 Apps," use Power Query instead. Power Query works in every Excel version since 2016.

How Do I Merge Spreadsheets Stored in OneDrive or SharePoint?

Two options. (1) Open both files in desktop Excel via OneDrive sync, then use Power Query as normal โ€” the file paths resolve to local sync paths. (2) Use Power Automate with Office Scripts: build a cloud flow that triggers when a new file lands in a folder, runs an Office Script to append data to a master file. The cloud route works even when your computer is off.
โ–ถ Start Quiz