Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Combine Tables in Excel

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can merge two or more tables in Excel by aligning them on a common column or using the Power Query tool to create a dynamic data model. The best method depends on whether you need a static result or a connection that updates automatically when the source data changes.

What You'll Need

  • A computer with Microsoft Excel installed (Desktop, Web, or Mac versions). Note that Power Query is available on the Desktop version and the Web version, but not on the Mac version as of the current official release.
  • Two or more datasets (tables) that share at least one column of data, such as a Customer ID, Product SKU, or Date.
  • A basic understanding of Excel ranges (e.g., knowing that A1:C5 covers columns A through C and rows 1 through 5).

Step-by-Step

  1. Prepare your source data. Ensure that both tables to be combined contain a header row in the first row. The column headers should match exactly (including spelling and spacing) if you intend to use them as a key to join the tables. For example, if one table has "Customer ID" and the other has "CustomerID", Excel will not recognize them as the same column. Remove any blank rows within the data range before combining.
  2. Open the Power Query Editor. Click anywhere inside the first table. Go to the "Data" tab on the ribbon and select "From Table/Range." If you have multiple separate tables, you must first convert each into an official Excel Table by selecting the data and pressing Ctrl+T (or Cmd+T on Mac). Click inside one of these tables, then select "Data" > "From Table/Range." This opens the Power Query Editor window.
  3. Append the second table. In the Power Query Editor, go to the "Home" tab and click "Append Queries." Choose the "Append Queries as New" button. In the dialog box, select "Two Tables" from the dropdown menu. Click the first arrow next to "Table1" and select your first dataset. Click the second arrow next to "Table2" and select your second dataset. Click OK.
  4. Append further tables (optional). If you have more than two tables to combine, you can repeat this process. Go back to the "Append Queries" button, select "Append Queries as New," and this time choose "Three or more Tables." Select all remaining datasets from the list and click OK.
  5. Load the combined data. Once all tables appear as a single list in the Power Query Editor, click "Close & Load" in the top-left corner of the ribbon. This will create a new worksheet in your workbook containing the combined data. The data will be in a standard Excel table format.
  6. Combine tables using a common column (VLOOKUP/XLOOKUP). If your tables are not the same width or you do not want to use Power Query, you can use a lookup formula. Assume Table 1 is in A1:D10 and Table 2 is in F1:J10. If you want to add a column from Table 2 to Table 1 based on a common ID column, click an empty cell in Table 1 (e.g., E2). Enter the formula: =XLOOKUP(A2, $F$2:$F$10, $G$2:$G$10). This looks for the value in cell A2 within the ID range of Table 2 and returns the corresponding value from the adjacent column G. Drag this formula down for all rows.

Common Mistakes

The most frequent error when combining tables is a mismatch in data types. For instance, one table might store customer IDs as numbers (e.g., 101) while another stores them as text (e.g., "101"). Excel will not find a match between these two types, resulting in #N/A errors. To fix this, select the ID column in both tables, go to the "Data" tab, and use "Text to Columns" to convert them to the same format, or use the VALUE() function to convert numbers to text.

Another mistake is failing to lock the reference ranges in lookup formulas. If you write =VLOOKUP(A2, F2:J10, 2, FALSE) and drag it down, Excel will shift the range down. It will try to look for the ID in F3:J11, which is empty, and return errors for subsequent rows. Always use absolute references by adding dollar signs around the range (e.g., $F$2:$F$10) to prevent this.

Tips

When using Power Query, it is good practice to rename your queries for clarity. Right-click on a query in the "Queries and Connections" pane on the left side of the editor and select "Rename." This helps you keep track of which query represents which original dataset.

If you are combining tables that have different column orders, Power Query will automatically stack them vertically. The data from the second table will appear directly under the rows of the first table. If you want the columns to align side-by-side, use the Merge Queries option in the Power Query Editor instead of Append Queries.

Troubleshooting

If your combined table shows #N/A errors when using a lookup formula, double-check the spelling of the common column headers. Ensure that there are no leading or trailing spaces in the data, as " 101" is not the same as "101." You can use the TRIM() function to remove extra spaces from a cell.

If Power Query fails to load the data, check for data type mismatches in the editor. Click on a column header to see the data type icon. If the types are different (e.g., Mixed or Any), right-click the column and choose "Change Type" to select a specific type like Whole Number or Text. This usually resolves loading errors.

Frequently Asked Questions

Can I combine tables from different Excel files?

Yes, but you must first open all files. You can load a table from one file into Power Query and then load a table from another file into the same query using the "Append Queries" feature. Alternatively, you can use the INDIRECT() function in a formula, though this is less stable than Power Query.

What is the difference between Append and Merge?

Append adds rows to the bottom of a table, creating a longer list with more columns. Merge combines columns based on a common key, creating a wider table with more rows.

Will the combined data update automatically?

If you use Power Query, yes. Any changes you make to the source tables will trigger the "Refresh All" button on the Data tab to update the combined table.

How do I remove duplicates after combining?

In the Power Query Editor, click on the column you want to check for duplicates, go to the "Home" tab, and select "Remove Rows" > "Remove Duplicates." In a standard formula, use the UNIQUE() function on an array of values.

Can I combine tables on a Mac?

Microsoft does not currently offer Power Query for Excel on the Mac platform. You must use the VLOOKUP, XLOOKUP, or INDEX/MATCH formulas to combine data on a Mac.