Smart Systems for Home

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

Excel Join Two Tables: Best Methods and Step-by-Step

· 6 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

To join two tables in Excel, the most powerful and modern method is using Power Query (Merge), though VLOOKUP and XLOOKUP remain popular for simple lookups. Joining tables allows you to combine data from two different sources into one master view based on a common identifier, such as a Customer ID or Product SKU, ensuring your data remains organized and scalable.

What You'll Need

  • Microsoft Excel (Power Query is available in Excel 2016 and later, or as an add-in for 2010/2013).
  • Two sets of data that share at least one common column (the "Join Key").
  • Data formatted as official Excel Tables (Ctrl + T) for the best results.

Step-by-Step

While there are several ways to connect data, using Power Query is the professional standard because it handles large datasets without slowing down your workbook and allows for easy refreshing when source data changes. Note that menu labels may differ slightly depending on your version of Excel or region.

Method 1: Using Power Query (The Merge Method)

  1. Convert Data to Tables: Select your first range of data and press Ctrl + T. Ensure "My table has headers" is checked. Repeat this for the second range of data. Give your tables descriptive names (e.g., "SalesTable" and "CustomerTable") via the Table Design tab.
  2. Load the First Table: Click anywhere inside your first table. Go to the Data tab on the ribbon and select From Table/Range. This opens the Power Query Editor window.
  3. Close and Load as Connection: Once the Power Query Editor opens, you don't need to make changes yet. Click the arrow under Close & Load in the Home tab and select Close & Load To.... In the dialog box, choose Only Create Connection and click OK.
  4. Load the Second Table: Repeat the process for your second table: Data > From Table/Range, then Close & Load To... > Only Create Connection.
  5. Merge the Tables: Go to the Data tab > Get Data > Combine Queries > Merge.
  6. Select Join Keys: In the Merge window, select your first table from the top dropdown and your second table from the bottom dropdown. Click on the common column (the Join Key) in both preview windows to highlight them.
  7. Choose the Join Kind: Select the "Join Kind." For most users, Left Outer is the correct choice; this keeps all rows from the first table and adds matching values from the second. Click OK.
  8. Expand the Columns: You will now see a new column containing "Table" values. Click the small icon with two diverging arrows in the column header. Uncheck "Use original column name as prefix" and select only the specific columns you want to bring over from the second table.
  9. Finalize the Join: Click Close & Load. Excel will create a new worksheet containing your joined master table.

Method 2: Using XLOOKUP (The Dynamic Method)

If you only need to bring one or two columns from Table B into Table A without creating a separate query, XLOOKUP is the fastest modern formula.

  1. Position Your Cursor: Click in the first empty cell of the column where you want the joined data to appear.
  2. Enter the Formula: Type =XLOOKUP(.
  3. Select Lookup Value: Click the cell in your current table that contains the Join Key (e.g., the ID in cell A2). Type a comma.
  4. Select Lookup Array: Go to the second table and select the entire column that contains the Join Keys. Type a comma.
  5. Select Return Array: Select the column in the second table that contains the data you actually want to retrieve (e.g., the Customer Name column).
  6. Close and Fill: Close the parenthesis ) and press Enter. Drag the fill handle down to apply the formula to the rest of the column.

Common Mistakes

  • Mismatched Data Types: This is the most frequent cause of errors. If the Join Key in Table A is formatted as "Text" but the Join Key in Table B is "Number," Excel will not see them as a match, even if they look identical. Ensure both columns are set to the same data type.
  • Leading or Trailing Spaces: A cell containing "ID123 " (with a space) will not match "ID123". This often happens with data imported from external software. Use the =TRIM() function to clean your keys before joining.
  • Duplicate Keys: If your second table has multiple rows for the same Join Key, a VLOOKUP or XLOOKUP will only return the first match it finds. Power Query, however, will create duplicate rows in the result to account for every match, which may unexpectedly increase the size of your final table.
  • Forgetting to Refresh: Unlike formulas, Power Query results do not update instantly when you change the source data. You must go to the Data tab and click Refresh All to update the joined table.

Tips

  • Use Named Tables: Instead of referencing ranges like A2:B500, use Ctrl + T to create tables. This makes your formulas dynamic, meaning if you add new rows to your source data, the join will automatically include them.
  • Power Query for Large Data: If you are joining tables with tens of thousands of rows, avoid VLOOKUP/XLOOKUP. Thousands of lookup formulas can make a workbook lag or crash. Power Query processes the data in the background and is significantly more efficient.
  • The "Inner Join" Option: In Power Query, if you only want rows that exist in both tables (discarding any that don't have a match), choose Inner Join. This is useful for cleaning lists to find only overlapping clients or products.
  • Data Cleaning in Power Query: Before clicking "Close & Load," use the Transform tab in Power Query to remove nulls, filter out unnecessary rows, or change case (e.g., making all IDs uppercase) to ensure a perfect match.

Troubleshooting

If your join is not working as expected, follow these steps in order:

  1. Check for #N/A Errors: If using XLOOKUP, #N/A means no match was found. Double-check that the ID actually exists in the second table.
  2. Verify Formatting: Select the Join Key column in both tables. Go to the Home tab and check the Number Format dropdown. If one is "General" and the other is "Text," change them to match.
  3. Search for Hidden Characters: Use the formula =LEN(cell) on your Join Keys. If one cell says "ID123" but LEN returns 6 instead of 5, there is a hidden space or non-printing character causing the mismatch.
  4. Clear Cache/Refresh: In Power Query, if the data looks old, go to Data > Refresh All. If the query fails, check if the source tables were renamed or moved to a different sheet.
  5. Check for Circular References: Ensure you aren't trying to join Table A into Table B while Table B is already being joined into Table A, as this can create a logic loop that crashes the calculation engine.

Frequently Asked Questions

Can I join more than two tables?

Yes. In Power Query, you can merge the result of your first join with a third table, and then a fourth, and so on. You simply repeat the Merge process using the newly created table as the starting point.

What is the difference between a Left Join and an Inner Join?

A Left Join keeps every row from your first table, regardless of whether a match is found in the second. An Inner Join deletes any rows from the first table that do not have a corresponding match in the second table.

Does joining tables slow down my Excel file?

Formulas like VLOOKUP can slow down files because they recalculate every time a cell changes. Power Query is generally faster because it only processes the data when you manually click Refresh.

Can I join tables from two different Excel files?

Yes. Instead of selecting From Table/Range, go to Data > Get Data > From File > From Excel Workbook. You can then merge tables from separate files just as you would within one workbook.

What should I do if my Join Key is made of two columns?

In Power Query, you can select multiple columns by holding Ctrl while clicking the headers in both tables. As long as you select the columns in the same order in both tables, Power Query will treat them as a single composite key.