Excel Combine Data From Multiple Tables

A good database is always structured. It means different entities have different tables. Although, Excel is not a database tool but is often used to maintain small chunks of data.

  1. Excel Combine Data From Multiple Sheets Into One Table
  2. Excel Combine Data From Multiple Tables Online
  3. Excel Combine Data From Multiple Tables Pdf

If you want to collect data from multiple sheets into one sheet in the same workbook, you can apply the Consolidate function in Excel. In a new sheet of the workbook which you want to collect data from sheets, click Data Consolidate. Creating a Pivot Table in Excel based on multiple tables or multiple sheets can be tricky. Often Lookup functions like VLOOKUP are used to consolidate the in. Indeed, when creating charts in Excel, the source data does not always reside on the same sheet. Fortunately, Microsoft Excel provides a way to plot data from two or more different worksheets in a single graph. The detailed steps follow below. Make a chart from multiple Excel sheets; Customize a chart created from several sheets. Execute the following procedure for both sheets. Select a value in one of the columns. Goto the Data tab and select From Table in the Get and Transform group. In the Query Editor select Close & Load to from the dropdown menu Close & Load on the Home tab.

Many times we get the need of merging tables in order too see a relationship and churn out some useful information.

Data

In databases like SQL, Oracle, Microsoft Access, etc, it is easy to join tables using simple queries. But in excel we don't have JOINs but we can still join tables in excel. We use Excel Functions to merge and join data tables. Perhaps it is a more customizable merge than SQL. Let’s see the techniques of merging excel tables.

Merge Data in Excel Using VLOOKUP Function

To merge data in excel, we should have at least one common factor/id in both tables, so that we can use it as a relation and merge those tables.
Consider these two tables below. How can we combine these data tables in Excel?

Excel Combine Data From Multiple Sheets Into One Table

Combine


The Order Table has order details and the Customer table contains customer details. We need to prepare a table that tells which order belongs to which customer name, customer’s points, house number, and his joining date.

The common id in both tables is Cust.ID which can be used for merging tables in excel.

Excel Combine Data From Multiple Tables Online

There are three methods of merging tables using VLOOKUP Function.

Retrieve Each Column With Column Index

In this method, we will use simple VLOOKUP to add these tables in one table. So to retrieve name write this formula.

[Customers is Sheet1!$I$3:$M$15.]

To merge points in table, write this formula.

=VLOOKUP(B3,Customers,3,0)

To merge house no in table, write this formula.


Here we merged two tables in excel, each column one by one in the table. This is useful when you have only few columns to merge. But when you have multiple columns to merge, this is can be a hectic task. So to merge multiple tables we have different approaches.

Merge Tables Using VLOOKUP and COLUMN Function.

Excel combine data from multiple tables pdf

Excel Combine Data From Multiple Tables Pdf

When you want to retrieve multiple adjacent columns, use this formula.

=VLOOKUP(lookup_value,table_array,COLUMN()-n,0)

Here the COLUMN function just returns the column numbers in which the formula is being written.

Excel

n is any number which adjusts the column number in table array,

In our example, the formula for table merging will be:

Once you write this formula, you will not have to write the formula again for other columns. Just copy it in all other cells and columns.
How It Works

Ok! In the first column, we need a name, which is the second column in customer table.

Here the main factor is COLUMN()-2. The COLUMN function returns the column number of current cell. We are writing the formula in D3, hence we will get 4 from COLUMN(). Then we are subtracting 2 which makes 2. Hence finally our formula simplifies to =VLOOKUP($B3,Customers,2,0).

When we copy this formula in E columns we will get the formula as =VLOOKUP($B3,Customers,3,0). Which retrieves 3rd column from customer table.

Merge Tables Using VLOOKUP-MATCH Function
This one is my favorite way of merging tables in excel using the VLOOKUP function. In the above example, we retrieved column in serial. But what if we had to retrieve random columns. In that case above Techniques will be useless. The VLOOKUP-MATCH technique uses column headings to merge cells. This is also called VLOOKUP with Dynamic Col Index.

For our example here, the formula will be this.

=VLOOKUP($B3,Customers,MATCH(D$2,$J$2:$N$2,0),0)


Here, we are simply using MATCH function to get the appropriate column number. This called Dynamic VLOOKUP.

Using INDEX-MATCH to Table Merging in Excel
The INDEX-MATCH is very powerful lookup tool and many time it is referred as better VLOOKUP function. You can use this to for combining two or more tables. This will also allow you to merge columns from left of the table.

This was a quick tutorial about merging and joining tables in excel. We explored several ways of merging two or more tables in excels. Feel free to ask question about this article or any other query regarding excel 2019, 2016, 2013 or 2010 in the comments section below.

Related Articles:

Popular Articles :

50 Excel Shortcut to Increase Your Productivity : Get faster at your task. These 50 shortcuts will make you work even faster on Excel.

How to use the VLOOKUP Function in Excel : This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.

How to use the COUNTIF function in Excel : Count values with conditions using this amazing function. You don't need to filter your data to count specific values. Countif function is essential to prepare your dashboard.

How to use the SUMIF Function in Excel : This is another dashboard essential function. This helps you sum up values on specific conditions.

-->

This sample combines data from multiple Excel tables into a single table that includes all the rows. It assumes that all tables being used have the same structure.

There are two variations of this script:

Excel
  1. The first script combines all tables in the Excel file.
  2. The second script selectively gets tables within a set of worksheets.

Sample code: Combine data from multiple Excel tables into a single table

Download the sample file tables-copy.xlsx and use it with the following script to try it out yourself!

Sample code: Combine data from multiple Excel tables in select worksheets into a single table

Download the sample file tables-select-copy.xlsx and use it with the following script to try it out yourself!

Training video: Combine data from multiple Excel tables into a single table

Watch Sudhi Ramamurthy walk through this sample on YouTube.