Merging databases in Excel means combining two or more tables that share a common field into one consolidated table, usually with Power Query or a lookup formula. The quickest reliable method is Power Query: put both tables in Excel (or point to them), use Data > Get Data to load each one, then Home > Merge Queries and pick the matching column in each table. Excel returns a single table you can expand, refresh, and reuse. Menu labels can differ slightly by Excel version, platform, and region, so treat the exact wording as a guide.
What You'll Need
- Excel for Microsoft 365, Excel 2021, or Excel 2019 on Windows or Mac. Power Query is built in on these versions; older releases may need the Power Query add-in.
- At least two tables, each with a header row and a column that identifies a record, such as Customer ID, SKU, or Email.
- Clean keys: no leading or trailing spaces, consistent capitalization if your data is case-sensitive, and the same data type on both sides (text vs. number is the most common mismatch).
- A destination sheet or a new workbook where the merged output can land.
Step-by-Step
- Format each source as a table. Select the range, press Ctrl+T (Cmd+T on Mac), confirm the header row, and give the table a name in Table Design. Named tables make Power Query easier to point at and easier to refresh later.
- Load the first table into Power Query. Click anywhere in the table, then go to Data > From Table/Range. The Power Query Editor opens. Check that the column headers are correct and that the key column has the right data type (click the icon at the left of the header to change it).
- Load the second table the same way. In the Power Query Editor, use Home > Close & Load > Close & Load To and choose Only Create Connection so the second table sits in the workbook without adding a visible sheet. Repeat Data > From Table/Range for the second table and close it to a connection as well.
- Start the merge. In the Power Query Editor, go to Home > Merge Queries (or Merge Queries as New if you want to keep the originals untouched). Pick the first table from the dropdown, then the second table.
- Select the matching key column in each table. Click the key column in the top preview and the matching key column in the bottom preview. Excel highlights the pair. If the key names differ (CustomerID vs. Cust_ID), that is fine as long as the values match.
- Choose the join kind. Left Outer keeps every row from the first table and adds matches from the second; Inner keeps only rows that exist in both; Full Outer keeps everything from both sides. For most database merges, Left Outer is the safe default because it preserves your primary records.
- Expand the merged column. After you click OK, a new column appears with the word Table in each cell. Click the expand icon (two arrows) in that column header, tick the fields you want to bring across, and clear the box that says Use original column name as prefix if you want clean headers.
- Clean up and load. Remove helper columns, rename the merged fields, and set data types. Then Home > Close & Load to send the result to a new worksheet or the Data Model.
- Refresh when sources change. Right-click the output table and choose Refresh, or use Data > Refresh All. Power Query re-runs the merge against the current source tables, so you do not repeat the steps.
- Use a formula alternative for small, one-off merges. If you only need to pull a few fields and do not want Power Query, use XLOOKUP (or INDEX and MATCH in older versions): =XLOOKUP(A2, Sheet2!A:A, Sheet2!C:C, "Not found"). This is fine for a quick check but does not scale as cleanly as a query.
Common Mistakes
- Mismatched data types. A customer number stored as text on one sheet and as a number on the other will produce no matches. Convert both key columns to the same type before merging.
- Hidden spaces and stray characters. Trailing spaces, non-breaking spaces, and inconsistent capitalization break exact matches. Use Transform > Format > Trim and Clean in Power Query before merging.
- Duplicate keys. If the second table has more than one row per key, a Left Outer merge produces multiple output rows per original record. Decide in advance whether you want the first match, a sum, or a grouped result.
- Merging on the wrong column. Name columns clearly and check the preview before clicking OK. A merge on a name field rather than an ID is a frequent source of silent errors.
- Editing the output table by hand. Typed-in changes are lost on refresh. Make changes in the source tables or in the query steps instead.
Tips
- Keep source tables in the same workbook or in a folder Power Query can reach; moving files breaks the connection.
- Use Merge Queries as New when you want to compare results or keep the original queries intact.
- Name every query step meaningfully in the Applied Steps pane so you can trace what happened.
- For repeated merges, save the query as a connection-only query and load only the final output.
- If you merge more than two tables, chain merges one at a time and check row counts after each step.
Troubleshooting
- No matches at all. Check data types, trim spaces, and confirm the key values actually exist on both sides. A quick COUNTIF against the other table shows how many matches to expect.
- Row count explodes after merging. The second table likely has duplicate keys. Group the second table by key first, or choose a join kind that fits your intent.
- Refresh fails after moving files. Update the source path in Data > Queries & Connections > Properties, or put the files back where the query expects them.
- Column names look wrong. Re-expand the merged column and clear the prefix option; then rename fields in the query, not in the sheet.
- Excel is slow on large tables. Load only the columns you need, filter early in the query, and avoid loading intermediate queries to worksheets.
Frequently Asked Questions
Can I merge more than two tables at once?
Not in a single step. Merge two, expand the result, then merge that output with the next table. Each merge is a separate step in the query.
What is the difference between merging and appending?
Merging joins tables side by side on a shared key. Appending stacks tables with the same columns on top of each other. Use Append when you have monthly files with identical layouts.
Does merging change my original data?
No. Power Query reads the sources and produces a new output table. The originals stay as they are unless you edit them directly.
Can I merge tables from two different workbooks?
Yes. Load each workbook's table as a query, then merge the queries. Keep both files in stable locations so refresh continues to work.
Why does my merged column show "Table" instead of values?
That is normal. The merged column holds a nested table; click the expand icon in the column header and choose the fields to bring across.
Is XLOOKUP a replacement for Power Query merging?
For small, static lookups, yes. For repeatable merges across large or changing datasets, Power Query is more robust and easier to refresh.