*In this tutorial, you will find some tricks on merging Excel tables by matching data in one or more columns as well as combining worksheets based on column headers.*

When analyzing data in Excel, how often do you have all necessary information gathered in a single worksheet? Almost never! It is a very common situation when different pieces of data are dispersed across many worksheets and workbooks. Fortunately, there are a few different ways to combine data from multiple tables into one, and this tutorial will teach you how to do this quickly and effectively.

## How to merge two tables in Excel with formulas

Whatever task you need to perform in your worksheets, where do you look for a solution in the first place? Like many users, I usually go to the *Formulas* tab and open a list of functions. Merging tables is no exception :)

### How to join tables with VLOOKUP

If you are to merge two tables based on **one column**, VLOOKUP is the right function to use.

Supposing you have two tables in two different sheets: the main table contains the seller names and products, and the lookup table contains the names and amounts. You want to combine these two tables by matching data in the *Seller* column:

As you see, the order of the names in the main table does not correspond with that in the lookup table, therefore a simple copy/pasting technique won't work.

To combine two tables by a **matching column **(*Seller*), you enter this formula in C2 in the main table:

`=VLOOKUP($A2,'Lookup table'!$A$2:$B$10,2,FALSE)`

Where:

*$A2*is the value you are looking for.*'Lookup table'!$A$2:$B$10*is the table to search (please pay attention that we lock the range with absolute cell references).*2*is the number of the column from which to retrieve the value.

Copy the formula down the column, and you will get a **merged table** consisting of the main table, plus the matched data pulled from the lookup table:

Please be aware that Excel VLOOKUP has several limitations, the most critical of which are 1) inability to pull data from a column to the left of the lookup column and 2) a hardcoded column number breaks a formula when you add or remove columns in the lookup table. On the bright side, you can easily reorder the returned columns simply by changing the number in the *col_index_num* argument.

Tip. If you have an Excel 365 subscription, then you can use a more powerful successor of VLOOKUP - Excel XLOOKUP function.

### How to merge tables in Excel with INDEX MATCH

If you are looking for a more powerful and versatile alternative to the VLOOKUP function, embrace this INDEX MATCH combination:

**INDEX (**

*return_range*

**, MATCH (**

*lookup_value*

**,**

*lookup_range*

**, 0))**

The syntax is explained in detail in this tutorial: INDEX / MATCH in Excel. And here I will show you how to use this formula to **look up from right to left**, something that VLOOKUP is unable to do.

Let's say you have another lookup table with order IDs in the first column and you wish to copy those IDs to the main table by matching the seller names. For better visualization, both tables are put on the same sheet:

To accomplish the task, you supply the following arguments to the Index Match formula:

*Return_range *- $E$2:$E$10*Lookup_value*- $A2*Lookup_range*- $F$2:$F$10

Please notice the $ sign that locks the ranges to prevent them from changing as you copy the formula down the table:

The completed formula looks as follows:

`=INDEX($E$2:$E$10, MATCH($A2, $F$2:$F$10, 0))`

…and combines data from two tables perfectly:

In Excel 365, you can use the new XLOOKUP function for the same purpose:

`=XLOOKUP(A2, $F$2:$F$10, $E$2:$E$10, "Not found")`

### How to combine tables by matching multiple columns

If the two tables you wish to join do not have a unique identifier, such as an order id or SKU, you can match values in two or more columns by using this formula:

**INDEX(**

*lookup_table*

**, MATCH(1, (**

*lookup_value1*

**=**

*lookup_range1*

**) * (**

*lookup_value2*

**=**

*lookup_range2*

**), 0),**

*return_column_number*

**)**

Note. It is an array formula, so please remember to press Ctrl + Shift + Enter to enter it correctly.

The formula's breakdown can be found here: Look up with multiple criteria. For now, let's focus on the practical usage.

Assuming you have the following two tables to be combined into one. Because the *Order ID *column is missing in the lookup table, the only way to match the orders is by *Seller* and *Product*:

Based on the above screenshot, let's define the arguments for our formula:

*Lookup_table*- $F$2:$H$9*Lookup_value1*- $B2*Lookup_range1*- $F$2:$F$9*Lookup_value2*- $C2*Lookup_range2*- $G$2:$G$9*Return_column_number *- 3

Again, be sure to fix all the **ranges** with **absolute cell references** so that they won't change when you copy the formula down:

`=INDEX($F$2:$H$9, MATCH(1, ($B2=$F$2:$F$9) * ($C2=$G$2:$G$9), 0), 3)`

Enter the formula in D3, press Ctrl + Shift + Enter, copy it to the below rows and check the result:

To have a closer look at the above examples and probably reverse-engineer the formulas, you are welcome to download our sample workbook to Merge Two Tables in Excel.

## Join multiple tables into one with Excel Power Query

In situations when you need to combine two or more tables with different numbers of rows and columns, Excel Power Query may come in handy. However, please be aware that joining tables with Power Query cannot be done with a mere couple of clicks. Explaining all the nuances would take far more space than we have here, so I will just briefly outline the main features:

- Power Query can merge two tables by matching one or several columns.
- The source tables can be on the same sheet or in different worksheets.
- The original tables are not changed. The data is combined into a new table that can be imported in an existing or a new worksheet.
- In Excel 2016 - Excel 365, Power Query is an inbuilt feature. In Excel 2010 and Excel 2013, it can be downloaded as an add-in.

The detailed guidance can be found in this tutorial: How to join tables with Excel Power Query.

## Merge Tables Wizard - quick way to join tables by matching columns

If you are not very comfortable with Excel formulas yet, nor do you have time to figure out the arcane quirks of Power Query, our Merge Tables Wizard could be your time-saver. Below I will show three most popular uses cases.

### Example 1. Combine two tables by multiple columns

If you find the array formula for columns match hard to remember, rely on our add-in to do the job quickly and perfectly.

For this example, we will be using the already familiar tables and join them based on 2 columns, *Seller* and *Product*. Please note that the lookup table has 2 more columns than the main table:

With the Merge Tables Wizard added to your Excel ribbon, here's what you need to do:

- Select any cell within your
**main table**and click the**Merge Two Tables**button on the*Ablebits Data*tab: - Make sure the add-in got the range right, and click
*Next*: - Select the lookup table, and click
*Next*: - Specify the column pairs to match,
*Seller*and*Product*in our case, and click*Next*:Tip. If the text case in the key columns matters, check the

*Case-sensitive matching*box to treat uppercase and lowercase as different characters. - Optionally, choose the columns to update with the values from the lookup table. Since there is nothing to update in the
*Order IDs*column, we leave it unselected, and simply click*Next*. - Select the columns to add to the main table and click
*Next*. - In this step, you tell the wizard how exactly you want the tables to be merged. All the options have descriptive labels, so I won't go into long explanations. If you are unsure about a certain option, click the question mark next to it, and a small diagram will show you how the tables are going to be combined.

The default options work just fine in our case, so we click *Finish* without changing anything:

Allow the wizard a few seconds for processing and review the result:

As you can see in the screenshot above, the wizard has done the following:

- Added the
*Amount column*by matching the seller name and product in both tables. - Added the
*Status*column that allows you to easily filter matching and new rows. If you don't want it, clear the corresponding box in the final step. - New rows that were present only in the lookup table were copied to the end and highlighted in blue.
- If you don't want to highlight new rows, unselect
*Set background color for all added rows*in the last step. - If you don't want to add new rows, unselect
*Add non-matching rows to the end of the main table*in the last step.

- If you don't want to highlight new rows, unselect

### Example 2. Join tables and update selected columns

In case your main table contains some outdated data, you can have it updated with the corresponding values from the lookup table.

As an example, let's merge 2 tables by *Order ID* and update the values in the *Price* column:

To get the result shown in the above image, this is what you need to do:

Step 1. Select the main table.

Step 2. Select the lookup table.

Step 3. Choose *Order ID* as the matching column.

Step 4. Select *Price* as the column to update.

Step 5. Skip it because there are no columns to add.

Step 6. Since there are a few gaps in the *New price* column, we choose to *update only if cells in the lookup table contain dat*a. Optionally, you can *highlight the updated cells* with any color of your choosing. The screenshot below shows the settings:

Tip. To prevent overwriting your existing data, you can **update** **only** **empty cells** in the main table.

### Example 3. Merge multiple matches from two tables

In situations when a lookup table contains several occurrences on the lookup value, you may want to pull them all to your main table. The task can be accomplished with one of the non-trivial array formulas described in Vlookup to return multiple matches in Excel. Or you can do it the easy way with the Merge Tables Wizard.

Supposing your main table contains just one order of each seller, and the lookup table contains additional orders. Now you want to combine all the orders in one table, grouped by seller name like this:

Looks like a lot of work to do? Not if you have the Merge Tables Wizard at your disposal :)

Step 1. Select the main table.

Step 2. Select the lookup table.

Step 3. Choose *Seller *as the column to match.

Step 4. Update *Order ID* and *Product*.

Step 5. There are no columns to add.

Step 6. Insert additional matching rows *after the row with the same key value*. Optionally, set a *background color* for added rows to review the changes with a quick glance:

The above examples show just 3 of many possible ways to join tables in Excel. If you are curious to see other scenarios that the Merge Table Wizards can handle, please check out the visuals on this page. Or you can download a 30-day trial version and give it a shot.

## Combine tables in Excel by column headers

In the above examples, we were merging two tables that have identical columns and pulling data from one table to another. In case you want to join multiple tables from different sheets into one based on columns headers, our Combine Sheets add-in is the right tool for the job.

The below image shows the source tables and desired result:

And here's how you can accomplish the task:

- On your Excel ribbon, go to the
*Ablebits*tab >*Merge*group, and click the**Combine Sheets**button: - Select all the worksheets you want to merge into one.
If you'd like to combine just one table, not all data, hover over the sheet's name, and then click the

*Collapse dialog*icon on the right to select a range: - Choose the columns you want to combine,
*Order ID*and*Seller*in this example: - Select additional options, if needed. We go with the default ones that work perfectly in most cases:
- Finally, specify where you want to put the resulting table, and click
**Combine**:

Done! The three tables are combined into one exactly like shown in the beginning of this example.

## More tools to merge tables in Excel

The Merge Tables Wizard and Combine Sheets are the most popular tools to join tables in Excel. If you have some other task in mind, chances are that you will also find a quick solution on the *Ablebits Data* tab:

Let me briefly describe what each of these add-ins does:

Merge Two Tables - joins two tables that have one or more identical columns, as shown in these examples.

Combine Sheets - merges multiple worksheets into one based on column headers, like we did a moment ago in this example.

Merge Duplicates - combines duplicate rows by key columns.

Consolidate Sheets - joins tables together and summarizes their data.

Copy Sheets - provides 4 different ways to merge sheets in Excel.

Merge Cells - merge cells, columns, and rows without losing data, even if a selection contains multiple values.

Vlookup Wizard - quick way to build a Vlookup or Index/Match formula best suited for your data set.

Compare Sheets - find, highlight, and merge differences between two worksheets.

Compare Multiple Sheets - highlight differences in two or more sheets.

All the above features as well as 70+ other time-saving tools are included with our Ultimate Suite for Excel. An evaluation version is available for download right below this post. I thank you for reading and hope to see you on our blog next week!

## Available downloads

Ultimate Suite 14-day fully-functional version (.exe file)

## 28 comments

I have a sheet that has various tabs with same columns, but I need to add a *new column from TAB A to the rest of the TABS based a the description of the *rest of the tabs' columns.

If; Where new column named CODE on the rest of the TABS = the input of column named CODE (but also match the input of the column named DESCRIPTION, which mirror/replicate the input rest of the tabs.)

TAB A

HEADER COLUMNS= Visit>Visit ABRV> CODE>DESCPT

REST OF TABS

*NEW COLUMN (CODE) = when DESCPT from TAB A matches DESCPT column from *rest of tabs on the sheet.

Hello!

To solve your problem, I recommend using the Merge Tables Wizard, as described in the article above.

Hi!

I have a question regarding INDEX/MATCH. It seems to mostly work for me, however when I try to extend the formula downwards, it changes the INDEX array and MATCH lookup array selection downwards. Here's an example:

For the 1st value (in 2nd row) I use the following formula: INDEX(G2:G5284;MATCH(A2;F2:F5284;0))

For the 2nd value the formula then becomes: =INDEX(G3:G5284;MATCH(A3;F3:F5284;0))

where what I'd want is INDEX(G2:G5284;MATCH(A3;F2:F5284;0))- change in lookup value but not the array.

This is a problem, because many of the outputs will then become #N/A- the lookup value will fall outside the lookup array. I tried to fix this by manually editing the first few formulas and extending the formulas downwards, but that doesn't work. Does anyone have a fix for that?

Best,

Timm

Hello!

Try to use the recommendations described in this article: How to copy formula in Excel with or without changing references.

Please try the following formula:

=INDEX($G$2:$G$5284;MATCH(A3;$F$2:$F$5284;0))

I have two sheets. Sheet2 has 1741 rows and Sheet1 has 324. Sheet1 column A has id numbers that all exist in Sheet2 column D. I want to append the text cells (Columns $B:$H) from sheet1 to the matching rows in sheet2. I have tried multiple formulas and keep getting error with formula messages. I have tried using vlookup in different forms including from the above:

=VLOOKUP($D2,'sheet1'!$A2$H324,2,FALSE)

But that calculates some number that I have no idea where it came from.

Hello!

For column B you can use this formula:

=VLOOKUP($D2,Sheet1!$A$2:$H$324,2,FALSE)

We have tools that can solve your task in a couple of clicks - Vlookup Wizard and Merge Two Tables. It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free

can anyone help me for excel

A B C D E

456 ram ram 456 345

345 ram shyam 213 545

213 shyam krishna 548 724

545 shyam

548 krishna

724 krishna

I want a result in column B if column A is equal to column D and column E

then i want a result in column B with name ram shyam krishna

Hi!

I don't really understand what conditions you want to use, but this article will help you: Excel IF statement with multiple AND/OR conditions.

In "sheet1" I have this format says

rows Cell A1=Employee Names referring to cell B1=John, cell F1=Maria, cell G1=Peter & cell K1=Mark

now in "Sheet2" I want to lookup those Employee Names resulting in this format says column cell A1=John, cell A2=Maria, cell A3=Peter, cell A4=Mark.

Is there any formula to consolidate those names? Thanks

Hello!

You cannot consolidate rows and columns. Therefore, on Sheet 2, you need to perform the Transpose operation. You can then merge the column data on both sheets using the Consolidate Sheets or Combine Sheets tools.

I hope I answered your question. If something is still unclear, please feel free to ask.

Hi Svetlana Cheusheva

I have six sheets that have purchases of six companies, the amount of data is huge one of these sheets has over 70000 rows of data. my goal is to extract the mutual purchases items only between these companies. is there any way to do this because I have tried many ways to do so but I haven't managed.

Thanks in advance for your time and effort

Dear Svetlana,

Thankyou for this it is very helpful. Could you guide me on the appropriate option for my below issue.

I have a file(ytd) that I need to update monthly, with monthly figures. So my file that needs to be updated has 3 columns with data, now to this data/figures I need to add the monthly figures and arrive at the the updated total figures ytd.

YTD file Column1 =5

MTD file Column1 =3

Updated YTD file Column1 =8

Please guide.

I am a full noob !

I have suppliers who have given me tables with door models on the top row sizes down the left column and pricing to the right column under the door models

How do i combine these tables to read read :

Door model, door size, and door price so i can import these items into my catalogue.

I have searched everywere - in the past i have used concatenate but there must be an easier way to combine 20000 plus items a section at a time ? This information will be LIFE CHANGING to me, thanks in advance ! I am trying my best !

Hello George!

I hope you have studied the recommendations in the above tutorial. We have a tool that can solve your task in a couple of clicks: Ablebits Data - Merge Tables.

This tool is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and use for free: https://www.ablebits.com/files/get.php?addin=xl-suite&f=free-trial

Unfortunately, without seeing your data it is impossible to give you advice.

I'm sorry, it is not very clear what result you want to get. Could you please describe your task in more detail and send us a small sample workbook with the source data and expected result to support@ablebits.com? Please shorten your tables to 10-20 rows/columns and include the link to your blog comment.

We'll look into your task and try to help.

Is there a size limit to your combine tables add in? I’ve got a couple data tables with ~3,700 rows. I need to join 2 such tables each with about 10 columns. A numeric code is the common column between them.

Can you please update this guide to also include the steps to merge tables using the new XLOOKUP function as an alternative to VLOOKUP and INDEX/MATCH?

Hi Jason,

It's an excellent suggestion, thank you! I have added an XLOOKUP formula to the INDEX/MATCH example. As soon as I have a little more time, I will try to describe it in more detail.

In the meantime, you can take a look at our XLOOKUP tutorial that covers a lot of interesting use cases. Hopefully, you'll find the examples useful.

I have two tables like with these records:

Table 1: Badge# | Name | EmployeeID

Table 2: EmployeeID | SchoolID | Name | Badge#

Is there any ways that I can get the badge# record from table1 to the badge# in table 2 with the matching EmployeeID.

Thank you.

Hello,

I have been trying to combine a couple of sheet with one common value, how would you combine this:

If Sheet1!A1 = Sheet2!B2 then combine Sheet2!C2:sheet2!I15

Thanks in advance!

Just came across this article. Looks like a very old question but in case anyone else has the same thought, first ask yourself: If I have a one to many relationship I want to join, could I perhaps have the LOOKUP on the MANY side instead of the ONE, to yield the same result.

Not sure your data structure or if the rows are fixed. You have many possible routes. If your goal (for example) is to use a one to many relationship and list all matches from sheet2 in columns to the right of sheet1, combining multiple columns into each cell, you might do this:

Sheet 1 - Match values (ie names) in column A starting cell A2. Target columns for dropping results and entering formula starting D2.

Sheet 2 - Match values (ie names) in column A starting cell A3. A date column in B and a text value in C.

Formula (for A2 - don't forget ctrl shift enter):

{=IFERROR(TEXT(INDEX(Sheet2!$B$3:$B$9999, SMALL(IF($A2=Sheet2!$A$3:$A:$99999,ROW(Sheet2!$A$3:$A$99999)-MIN(ROW(Sheet2!$A$99999))+1,""),COLUMN()-3)),"YYYY/MM/DD")&":","")

&

IFERROR((INDEX(Sheet2!$C$3:$C$9999, SMALL(IF($A2=Sheet2!$A$3:$A:$99999,ROW(Sheet2!$A$3:$A$99999)-MIN(ROW(Sheet2!$A$99999))+1,""),COLUMN()-3)))&":","")}

hey there;

I have a question, is there any way to overlay tables like he following;

table 1;

monday tues wed thurs friday

10 m10 t10 w1o th10 fri10

11 m11 t11 w11 th11 fri11

12 m12 t12 w12 th12 fri12

13 m13 t13 w13 th13 fri13

table 2;

monday tues wed thurs friday

10 M10 T10 W1o TH10 FRI10

11 M11 T11 W11 TH11 FRI11

12 M12 T12 W12 TH12 FRI12

13 M13 T13 W13 TH13 FRI13

and get the resulting table:

monday tues wed thurs friday

10 m10 t10 w1o th10 fri10

M10 T10 W1o TH10 FRI10

11 m11 t11 w11 th11 fri11

M11 T11 W11 TH11 FRI11

12 m12 t12 w12 th12 fri12

M12 T12 W12 TH12 FRI12

13 m13 t13 w13 th13 fri13

M13 T13 W13 TH13 FRI13

Hi,

I was wondering if it was possible to put the Merge Two Tables feature in a macro or VBA script? I have to do this process multiple times a month and I'd like to automate it.

tHANK YOU VERY MUCH

~ Amazing Add-in! Thank you very much for still developing this very useful and resourceful tool, Keep it up! =)

Hi,

I have a question. I just bought the add-in but I am unable to figure out what I want to do.

I have excel sheets for each projects I am working on.

Sheet Project A

Table1, Columns: Task, Assigned to, Start date, Due date, Status

Sheet Project B

Table2, Columns: Task, Assigned to, Start date, Due date, Status

Sheet Project C

Table3, Columns: Task, Assigned to, Start date, Due date, Status

And now I want to view all the tasks created in these three tables on 1 single table.

Could you tell me how to do it?

Best regards,

Baatarbat

Hi Svetlana,

I read your posts with interest. I hope you can help me with my query:

I have three one-column tables and wish to create a new 3-column table combining them in the following way:

TableA:

Item_A1

Item_A2

Item_A3

TableB:

Item_B1

Item_B2

TableC:

Item_C1

Item_C2

Item_C3

Item_C4

NewTable:

Item_A1 Item_B1 Item_C1

Item_A1 Item_B1 Item_C2

Item_A1 Item_B1 Item_C3

Item_A1 Item_B1 Item_C4

Item_A1 Item_B2 Item_C1

Item_A1 Item_B2 Item_C2

Item_A1 Item_B2 Item_C3

Item_A1 Item_B2 Item_C4

Item_A2 Item_B1 Item_C1

Item_A2 Item_B1 Item_C2

Item_A2 Item_B1 Item_C3

Item_A2 Item_B1 Item_C4

Item_A2 Item_B2 Item_C1

Item_A2 Item_B2 Item_C2

Item_A2 Item_B2 Item_C3

Item_A2 Item_B2 Item_C4

Item_A3 Item_B1 Item_C1

Item_A3 Item_B1 Item_C2

Item_A3 Item_B1 Item_C3

Item_A3 Item_B1 Item_C4

Item_A3 Item_B2 Item_C1

Item_A3 Item_B2 Item_C2

Item_A3 Item_B2 Item_C3

Item_A3 Item_B2 Item_C4

Please note that the number of rows in each of the three tables are dynamic and populated from SQL server queries. So, a copy/paste method is not practical. I think Power Query is the best approach but I don't how.

I need to publish/send reports based on the new table. So, if your "Ultimate Suite" provides a solution for me, does it need to be installed on the remote computers too?

Many thanks for your help.

Abbas

Hi Abbas,

I regret to tell you that none of our tools can help with this task. I am not sure that even Power Query can do that, at least I don't know a way. Sorry :(

Hi Abbas did you figure out how to do this?