Merge data with excel

Excel for Microsoft 365 for Mac Excel 2021 for Mac Excel 2019 for Mac Excel 2016 for Mac Excel for Mac 2011 More…Less

If you receive information in multiple sheets or workbooks that you want to summarize, the Consolidate command can help you pull data together onto one sheet. For example, if you have a sheet of expense figures from each of your regional offices, you might use a consolidation to roll up these figures into a corporate expense sheet. That sheet might contain sales totals and averages, current inventory levels, and highest selling products for the whole enterprise.

To decide which type of consolidation to use, look at the sheets you are combining. If the sheets have data in inconsistent positions, even if their row and column labels are not identical, consolidate by position. If the sheets use the same row and column labels for their categories, even if the data is not in consistent positions, consolidate by category.

Combine by position

For consolidation by position to work, the range of data on each source sheet must be in list format, without blank rows or blank columns in the list.

  1. Open each source sheet and make sure that your data is in the same position on each sheet.

  2. In your destination sheet, click the upper-left cell of the area where you want the consolidated data to appear.

    Note: Make sure that you leave enough cells to the right and underneath for your consolidated data.

  3. On the Data tab, in the Data Tools group, click Consolidate.

    The Consolidated button on the Data tab

  4. In the Function box, click the function that you want Excel to use to consolidate the data.

  5. In each source sheet, select your data.

    The file path is entered in All references.

  6. When you have added the data from each source sheet and workbook, click OK.

Combine by category

For consolidation by category to work, the range of data on each source sheet must be in list format, without blank rows or blank columns in the list. Also the categories must be consistently labeled. For example, if one column is labeled Avg. and another is labeled Average, the Consolidate command will not sum the two columns together.

  1. Open each source sheet.

  2. In your destination sheet, click the upper-left cell of the area where you want the consolidated data to appear.

    Note: Make sure that you leave enough cells to the right and underneath for your consolidated data.

  3. On the Data tab, in the Data Tools group, click Consolidate.

    The Consolidated button on the Data tab

  4. In the Function box, click the function that you want Excel to use to consolidate the data.

  5. To indicate where the labels are located in the source ranges, select the check boxes under Use labels in: either the Top row, the Left column, or both.

  6. In each source sheet, select your data. Make sure to include either the top row or left column information that you previously selected.

    The file path is entered in All references.

  7. When you have added the data from each source sheet and workbook, click OK.

    Note: Any labels that don’t match labels in the other source areas cause separate rows or columns in the consolidation.

Combine by position

For consolidation by position to work, the range of data on each source sheet must be in list format, without blank rows or blank columns in the list.

  1. Open each source sheet and make sure that your data is in the same position on each sheet.

  2. In your destination sheet, click the upper-left cell of the area where you want the consolidated data to appear.

    Note: Make sure that you leave enough cells to the right and underneath for your consolidated data.

  3. On the Data tab, under Tools, click Consolidate.

    Data tab, Tools group

  4. In the Function box, click the function that you want Excel to use to consolidate the data.

  5. In each source sheet, select your data, and then click Add.

    The file path is entered in All references.

  6. When you have added the data from each source sheet and workbook, click OK.

Combine by category

For consolidation by category to work, the range of data on each source sheet must be in list format, without blank rows or blank columns in the list. Also the categories must be consistently labeled. For example, if one column is labeled Avg. and another is labeled Average, the Consolidate command will not sum the two columns together.

  1. Open each source sheet.

  2. In your destination sheet, click the upper-left cell of the area where you want the consolidated data to appear.

    Note: Make sure that you leave enough cells to the right and underneath for your consolidated data.

  3. On the Data tab, under Tools, click Consolidate.

    Data tab, Tools group

  4. In the Function box, click the function that you want Excel to use to consolidate the data.

  5. To indicate where the labels are located in the source ranges, select the check boxes under Use labels in: either the Top row, the Left column, or both.

  6. In each source sheet, select your data. Make sure to include either the top row or left column information that you previously selected, and then click Add.

    The file path is entered in All references.

  7. When you have added the data from each source sheet and workbook, click OK.

    Note: Any labels that don’t match labels in the other source areas cause separate rows or columns in the consolidation.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Every day, most analysts merge data in Excel and other spreadsheet programs to get better insights. Consolidating data in Excel is part of a bigger process called data preparation, but as the number of new data sources increases, if you want to merge data in excel spreadsheets, it is getting harder to do.

At Trifacta we are passionate about creating radical productivity for business analysts, so we became experts in data preparation. Even though we make software that replaces Excel in some cases, inside our company we still merge data in Excel just like you do, because sometimes it’s still the right tool for the right job. So, we know from firsthand experience when consolidating data in excel with a spreadsheet is a good idea, and how to do it well.

As it turns out,  the terms “Merge” and “Consolidate” in Excel, refer to two separate functions. Because of that, we created a short guide to understanding them both, as well as what to do when consolidating data in Excel is no longer an option.

How to Consolidate Data in Excel

For this example, let’s say you are given two sets of data about the amount of loans a group of members have borrowed per year, each in an independent Excel workbook. You want to understand the total amount of loans borrowed by each member, so you may naturally wonder how to combine data in Excel.

If both sets of numeric data are already formatted in a similar way, such as prices always formatted as $1.00, you can use the Excel consolidate feature (under the ‘Data’ dropdown menu).

Open each sheet you plan to use and confirm that the data types you want to consolidate in Excel match.

  1. In a new empty worksheet, select ‘Consolidate.’
  2. In the ‘Function’ box, select the function you want to use. In this example, we’re using “Sum” to add together the total loans borrowed per member. 
  3. Under ‘Reference,’ select ‘Browse’ to identify the Excel workbooks you want to consolidate the data from. Add the source(s).
  4. Important: Make sure the labels match. Then hit ‘OK,’ watch the data propagate, and begin reviewing or analyzing the new sheet.

How to Merge Data from Two Excel Worksheets

Traditionally, VLookup has been one of the most important tools for merging data in Excel, but the process requires multiple steps and can easily tire analysts who must merge multiple columns across many datasets. Instead, let’s take a look at how we can do this same process all within the Excel Power Query editor. 

In this example, we’re using two individual datasets, the first containing basic member information, such as income, education, phone number, etc., and the second containing member loan information, such as the loan amount, interest rate, loan status, etc. Each dataset also contains a member ID, which will allow us to join the data on that common field in order to compare all of this data side by side. Here’s how to proceed:

  1. First, we’ll take a look at each dataset to roughly analyze their contents, and then open up a new worksheet for our merged dataset. 
  2. Next, we’ll click on the “Data” tab of our new worksheet and select “From Text/CSV” because the files that we’re working with are csv files. You can also import Excel files by selecting “Get Data.” 
  3. We’ll start by importing our file on basic member info, which will bring us into the Power Query editor. 
  4. Next, we’ll bring in our other dataset by selecting “New Source” and “Text/CSV” and we’ll see the dataset on loan information added to the left-hand side. 
  5. To merge these two datasets, we’re going to select “Merge Queries” and “Merge as New” so that we can have a separate space for our new dataset. 
  6. We know that the common data field is “member ID” so we’re going to select that column for both datasets. 
  7. Now, we’re going to delete some of the columns that we don’t need from our member information dataset. When we’re finished, we’re going to click on the icon next to “member_loans” to expand the dataset we just brought in. 
  8. Here, we’re going to select the columns that we want from our member loans dataset. We don’t need to bring in member ID, as it’s already a column in our member info dataset. 
  9. Once we’re finished selecting, we can rearrange these columns as it makes sense for our analysis. 
  10. And finally, we’ll hit “Close and Load” to see the finished, merged dataset in our blank worksheet.

Merge Data In Excel with Designer Cloud

As the scale and complexity of your data sources grow, you might find merging data with Excel is harder to do. For large and varied data sets, Excel becomes too complicated, cumbersome and slow to use when you are trying to merge data in Excel. That’s where Designer Cloud comes in. Designer Cloud is specifically designed to make this preparation process easier and more intuitive.

For example, imagine being able to save the specific merge functions you use to merge data in Excel, customized to each unique data source,  and then reuse and share them with your colleagues effortlessly.

With Designer Cloud, data preparation is accessible, intuitive, and scalable across the organization. By providing a connected application for users to explore, structure, and produce dashboard-ready datasets, Designer Cloud helps users deliver faster, more accurate analysis.

Designer Cloud was designed from the ground up to help reduce data cleansing and data preparation time. At Alteryx, we live and breathe data in order to provide easy-to-use, intelligent, visual data analysis that improves data understanding for any project or organization. Sign up for Free Designer Cloud today.

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.

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

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?


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.

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.]

=VLOOKUP(B3,Customers,2,0)

To merge points in table, write this formula.

=VLOOKUP(B3,Customers,3,0)

To merge house no in table, write this formula.

=VLOOKUP(B3,Customers,4,0)


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.

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.

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

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

=VLOOKUP($B3,Customers,COLUMN()-2,0)

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:

IF, ISNA and VLOOKUP function in Excel

IFERROR and VLOOKUP function in Excel

How to retrieve the entire row of a matched value in Excel

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.

Skip to content

How to Merge Two Spreadsheets in Excel (Consolidate) – 2023

How To Merge Two Spreadsheets in Excel (Consolidate) – 2023

We frequently need to summarize data from multiple Excel files or Excel sheets.

It is difficult to use formulas to combine multiple Excel files into a single sheet.

Formulas are prone to mistakes 🚧

Excel provides clever techniques for combining data from multiple sheets or excel files into a single sheet.

One of them is Excel consolidation 😍

You can practice with me by downloading the Excel workbooks here.

Let’s get started. 👍

Combine Excel sheets with ‘Consolidate’

First, let’s learn how to combine data from multiple sheets.

Here we have regional sales data for 4 weeks.

Week 1 sales
Week 2 sales
Week 3 sales
Week 4 sales

Each week’s sales are in its own Excel sheet in the same workbook.

Product names and regions are not in the same order 🤔

Make sure that no data list contains any blank rows or columns⚠️

Kasper Langmann, Microsoft Office Specialist

Now we want to combine all the data and create the monthly sales table (for all 4 weeks).

We will add a new sheet as “Master”. This sheet will serve as the destination sheet for the consolidated data.

  1. Select a cell in that master sheet to place our sales summary and go to the data tab.
Merge sheets - Go to the data tab
  1. Select “Consolidate” from the data tools group.

Then, you can see the “consolidate” dialog box.

Dialog box to consolidate data
  1. Select the consolidate method from the “Function box”.

In this example, we want to get the total of all the sheets. So, we select “Sum”.

There are several functions to combine Excel sheets such as SUM, COUNT, AVERAGE, MAX, MIN, PRODUCT, etc.

As we want to combine data to get the total of multiple worksheets, we select the “SUM” function.

Kasper Langmann, Microsoft Office Specialist
Functions to merge data in Microsoft Excel
  1. Click the collapse button of the reference box.

Then click on a single worksheet that contains merging data and select the data in that Microsoft Excel sheet. In this case, we first select sales data in the “Week 1” sheet.

Click collapse button to select source data to combine sheets
Selecting sales data in Week 1 sheet
  1. Click the expand dialog button and click the “Add” button. Then the data range will be added to the “All references”.
Click the Expand button

Repeat this step to get all the data in all the worksheets.

Pro Tip!

When you click on the other Excel sheets to get merging data, look at the reference!

Microsoft Excel will apply the previous cell range for the new worksheet as the reference.

If the data in all the sheets are in the same structure and the same layout, you can just click the “Add” button after you select the next worksheet 🥳

Now, it should look like this.

All references from multiple sheets
  1. Check the boxes for “Top row” and “Left column” to add labels to the merged data table. Then all column headers and row labels will be copied to the merged data table.
Adding row and column labels

You must make sure the unique labels are the same in merge sheets.

Microsoft Excel will show the unique labels as separate column headings if they contain any typos or differences⚠️

Kasper Langmann, Microsoft Office Specialist
  1. Check the box – “Create links to source data” and click “Ok”.
Combine data in Microsoft Excel - create link to source data

Do you want to manually update consolidated data in the master spreadsheet?

Then do not check the box – “Create links to source data”.

Kasper Langmann, Microsoft Office Specialist

Microsoft Excel will generate a consolidated data report in a single sheet by combining all the data of the selected sheets of the Excel file.

Summary of the Excel file.

Now you know how to combine data in one file.

Combine multiple Excel files with ‘Consolidate’

In reality, most of the time we collect data in multiple files.

So, we need to combine multiple excel files to get the consolidated data 🤨

In Microsoft Excel, we can combine data from multiple workbooks as well 🤗

  1. To merge Excel files, first, open all the Excel files to be merged. Before you start the process, it is better to save all the files in the same folder.
Open all the Excel workbooks
  1. Create a new workbook and follow steps 1- 3 and 6-7 to combine excel sheets in the new Excel workbook.

Now, the “consolidate” dialog box should look like this.

Following steps 1-3 and 6-7 that are used to combine data from multiple sheets in the same Excel workbook.
  1. Click the collapse button in the reference box and select the data ranges in Excel files one by one.

If the Excel spreadsheets are closed, click “Browse…” to locate the workbooks. You can see the folder path to the Excel workbook in the reference box. Then, manually enter the cell range after the exclamation mark of the folder path.

Browse and select the folder path
All references show file path to each workbook.

When you click “Ok”, you can get the data from separate files to one workbook.

Combined workbook - Merge workbooks

Pro Tip:

If you want to quickly go to the cell ranges of each workbook, you can apply name ranges to those ranges.

It is superfast and more accurate💪🏻

You can read the named ranges article to learn more about it.

That’s it – Now what?

You no longer need to manually enter formulas in the master spreadsheet to prepare a summary 🤩

This is only one of the many ways to merge data from several Excel sheets or files.

Do you know that you can combine multiple worksheets using VBA codes?

Yes, you can combine multiple excel files using VBA too.

You can access my free 30-minute online course on “Vigorous VBA” by clicking here 🧑🏻‍🎓

Other resources

The Consolidate tool in Microsoft Excel appears to be a Pivot Table.

However, Pivot Tables offer more flexibility than Excel Consolidate. Therefore, use Pivot Tables if you need more flexibility to make changes to the summary table.

You can read our articles about power query and VBA codes and use them to merge files in Microsoft excel 👍

Frequently asked questions

Yes, you can combine multiple files.

  1. Open all the files.
  2. Create a new Excel spreadsheet and select a cell where you want to have the upper left cell of the merged data.
  3. Click the “Consolidate” in the “data tab”.
  4. Select the function to combine multiple files.
  5. Pull data from multiple excel files by clicking the collapse button in the reference box. Click “Add” each time you select data from a new Excel spreadsheet.
  6. Click “Ok”.

It is one of the Microsoft Excel features to merge data into one file from multiple sheets or multiple files.

It can merge several sheets or several Excel spreadsheets easily and accurately into a new sheet.

  1. Copy the data from multiple sheets into one sheet.
  2. Select the data in the entire sheet.
  3. Go to the “Remove duplicates” in the Data tab.
  4. If you have copied headers from all the files, do not check the “My data has headers”.
  5. Click “Ok”. Now, data in separate sheets are combined into one sheet without duplicates.

Kasper Langmann2023-01-09T19:23:33+00:00

Page load link

With Power Query, working with data dispersed across worksheets or even workbooks has become easier.

One of the things where Power Query can save you a lot of time is when you have to merge tables with different sizes and columns based on a matching column.

Below is a video where I show exactly how to merge tables in Excel using Power Query.

In case you prefer reading the text over watching a video, below are the written instructions.

Suppose you have a table as shown below:

Merge Tables in Excel using Power Query - Table 1

This table has the data I want to use, but it’s still missing two important columns – the ‘Product Id’ and the ‘Region’ where the sales rep operates.

This information is provided as separate tables as shown below:

Merge Tables using Power Query - Table 2 & 3

To get all this information into a single table, you will have to merge these three tables so that you can then create a Pivot Table and analyze it, or use it for other reporting/dashboarding purposes.

And by merging, I don’t mean a simple copy paste.

You’ll have to map the relevant records from Table 1 with data from Table 2 and 3.

Now you can rely on VLOOKUP or INDEX/MATCH to do this.

Or if you’re a VBA whiz, you can write a code to do this.

But these options are time-consuming and complicated as compared with Power Query.

In this tutorial, I will show you how to merge these three Excel tables into one.

For this technique to work, you need to have connecting columns. For example, in Table 1 and Table 2, the common column is ‘Item’, and in Table 1 and Table 3, the common column is ‘Sales Rep’. Also, note that there should be no repetition in these connecting columns.

Note: Power Query can be used as an add-in in Excel 2010 and 2013, and is an inbuilt feature from Excel 2016 onwards. Based on your version, some images may look different (image captures used in this tutorial are from Excel 2016).

Merge Tables Using Power Query

I have named these tables as shown below:

  1. Tabel 1 – Sales_Data
  2. Table 2 – Pdt_Id
  3. Table 3 – Region

It isn’t mandatory to rename these tables, but it’s better to give names that describe what the table is about.

At one go, you can merge only two tables in Power Query.

So we will first have to merge Table 1 and Table 2 and then merge Table 3 into it in the next step.

Merging Table 1 and Table 2

To merge tables, you first need to convert these tables into connections in Power Query. Once you have the connections, you can easily merge these.

Here are the steps to save an Excel table as a connection in Power Query:

  1. Select any cell in Sales_Data table.
  2. Click the Data tab.Merge Tables using Power Query - Data tab
  3. In the Get & Transform group, click on ‘From Table/Range’. This will open the Query editor.Merge Tables using Power Query - from table range
  4. In the Query editor, click the ‘File’ tab.Merge Tables using Power Query - File tab in qury editor
  5. Click on ‘Close and Load To’ option.Merge Tables using Power Query - Close and Load to
  6. In the ‘Import Data’ dialog box, select ‘Only Create Connection’.Merge Tables using Power Query - only create connection
  7. Click OK.

The above steps would create a connection with the name Sales_Data (or any name that you have given to the Excel Table).

Repeat the above steps for Table 2 and Table 3.

So when you’re done, you will have three connections (with the name Sales_Data, Pdt_Id, and Region).

Merge table columns in Excel using Power Query - three queries

Now let’s see how to merge the Sales_Data and Pdt_Id table.

  1. Click on the Data tab.Merge Tables using Power Query - Data tab
  2. In the Get & Transform Data group, click on Get Data.
  3. In the drop-down, click on Combine Queries.
  4. Click on Merge. This will open the Merge dialog box.Merge Tables using Power Query - Combine queries merge queries options
  5. In the Merge dialog box, select ‘Sales_Data’ from the first drop down.Select Sales Data in the Merge Dialog box
  6. Select ‘Pdt_Id’ from the second drop down.Select Product Id in Merge dialog box
  7. In ‘Sales_Data’ preview, click on the ‘Item’ column. Doing this will select the entire column.
  8. In ‘Pdt_Id’ preview, click on the ‘Item’ column. Doing this will select the entire column.Select Columns that are common - merge tables in Excel
  9. In the ‘Join Kind’ drop-down, select ‘Left Outer (all from first, matching from second)’.Merge Tables in Excel using Power Query Join drop down
  10. Click OK.

The above steps would open the Query editor and show you the data from the Sales_Data with one additional column (of Pdt_Id).

Merge Tables using Power Query - Extra column when combining data

Merging the Excel Tables (Table 1 & 2)

Now the process of merging the tables will happen within the Query editor with the following steps:

  1. In the additional column (Pdt_Id), click on the double pointed arrow in the header.Click on double pointed arrow in Product Id column
  2. From the options box that opens, uncheck all the column names and only select Item. This is because we already have the product name column in the existing table, and we only want the product ID for each product.
  3. Uncheck the option ‘Use original column name as prefix’.
  4. Click Ok.

This would give you the resulting table that has every record from Sales_Data table and an additional column that has product ids as well (from the Pdt_Id table).

Merge tables with the extra column in sales data result

Now if you only want to combine two tables, you can load this Excel you’re done.

But we have three tables to merge, so there is more work to be done.

You need to save this resulting table as a connection (so that we can use it to merge it with Table 3).

Here are the steps to save this merged table (with data from Sales_Data and Pdt_Id table) as a connection:

  1. Click the File tab
  2. Click on ‘Close and Load to’ option.
  3. In the ‘Import Data’ dialog box, select ‘Only Create Connection’.
  4. Click OK.

This will save the newly merged data as a connection. You can rename this connection if you want.

Merge1 table in Power Query

Merging Table 3 with the Resulting Table

The process of merging the third table with the resultant table (that we got by merging Table 1 and Table 2) is exactly the same.

Here are the steps to merge these tables:

  1. Click on the Data tab.
  2. In the Get & Transform Data group, click on ‘Get Data’.
  3. In the drop-down, click on ‘Combine Queries.
  4. Click on ‘Merge’. This will open the Merge dialog box.
  5. In the Merge dialog box, Select ‘Merge1’ from the first drop down.
  6. Select ‘Region’ from the second drop down.
  7. In ‘Merge1’ preview, click on the ‘Sales Rep’ column. Doing this will select the entire column.
  8. In Region preview, click on the ‘Sales Rep’ column. Doing this will select the entire column.
  9. In the ‘Join Kind’ drop-down, select Left Outer (all from first, matching from second).
  10. Click OK.

The above steps would open the Query editor and show you the data from Merge1 with one additional column (Region).

Now the process of merging the tables will happen within the Query editor with the following steps:

  1. In the additional column (Region), click on the double pointed arrow in the header.
  2. From the options box that opens, uncheck all the column names and only select Region.
  3. Uncheck the option ‘Use original column name as prefix’.
  4. Click Ok.

The above steps would give you a table that has all the three tables merged (Sales_Data table with one column for Pdt_Id and one for Region).

Here are the steps to load this table in Excel:

  1. Click the File tab.
  2. Click on ‘Close and Load to’.
  3. In the ‘Import Data’ dialog box, select Table and New Worksheets options.
  4. Click OK.

This would give you the resulting merged table in a new worksheet.

One of the best things about Power Query is that you can easily accommodate any changes in the underlying data (Table 1, 2 and 3) by simply refreshing it.

For example, suppose Laura gets transferred to Asia and you get new data for the next month. Now you don’t have to repeat the above steps again. All you need to do is refresh the table and it will do everything it all over again for you.

Within seconds you’ll have the new merged table.

You May Also Like the Following Power Query Tutorials:

  • Combine Data from Multiple Workbooks in Excel (using Power Query).
  • Combine Data From Multiple Worksheets into a Single Worksheet in Excel.
  • How to Unpivot Data in Excel using Power Query (aka Get & Transform)
  • Get a List of File Names from Folders & Sub-folders (using Power Query)

When you’re working in Microsoft Excel, you may find that your data has become a little hard to follow, with data sets spread across separate sheets, pivot tables, and more. You don’t always need to use multiple worksheets or Excel files to work on your data, however, especially if you’re working as a team.

To help you keep your data organized, you can merge data in Excel. You can merge worksheets from separate files, merge separate Excel files into one, or use the consolidate feature to combine your data instead. 

Here’s how to merge Excel files and data together using these methods.

How To Move Or Copy Single Worksheets In Excel

A typical Microsoft Excel file is broken up into different sheets (or worksheets) which are listed as tabs at the bottom of the Excel window. They act like pages, allowing you to spread data across multiple sheets in a single file.

You can move or copy worksheets between different Excel files (or the same file, if you wish to duplicate your data sets).

  • To start, open your Excel file (or files). In the open window of the Excel file you wish to copy from, click on the worksheet you wish to select at the bottom of the Excel window. You can select multiple sheets by holding Shift and clicking on each sheet tab.
  • To begin copying or moving sheets, press the Home tab in the ribbon bar at the top.
  • From here, click Format > Move or Copy Sheet.
  • In the Move or Copy box, select the Excel file you wish to copy or move to from the To Box drop-down menu. Select where you wish to place the sheets in the Before Sheet section. By default, Excel will move the sheets—click the Create a copy checkbox if you’d prefer to copy them instead. 
  • Press OK to move or copy the worksheets once you’re ready.

The worksheets you selected will then be moved or copied, as desired, although this won’t merge them together entirely.

You can use the Move or Copy Sheet tool in Excel to merge data in multiple Excel files together. You can do this by selecting all of the active worksheets in a file, then merging them into your single target file, repeating this process for multiple files.

  • To do this, open your Excel files. In the open window of an Excel file you wish to move or copy into another file, select all of the sheet tabs at the bottom of the window by holding the Shift key and clicking on each sheet tab.
  • Next, press Home > Format > Move or Copy Sheet from the ribbon bar.
  • In the open Move or Copy dialog box, select the target Excel file to merge to from the To Box drop-down menu. Select where you wish to place your merged sheets in the Before sheet section. If you want to leave the original file intact, press Create a copy to copy the sheets rather than move them, then press OK to begin the moving or copying process.

If you have more than one Excel file, you’ll need to repeat these steps to merge them together into a single file.

Using The Consolidate Tool To Merge Data In Excel Together

Using the methods above, you can move and copy sheets between different Excel spreadsheet files. This moves the data, but it doesn’t integrate it particularly well—the data is still kept in separate sheets.

To get around this problem, you can use the Consolidate tool in Excel to merge numerical data together from multiple worksheets into a new, single worksheet. Unfortunately, this process doesn’t work with cells using text—you’ll need to cut and paste this data manually, or create a VBA script in Excel to do it for you.

For this to work, your data will need to be presented in the same way across your sheets with matching header labels. You’ll also need to delete any blank data (for instance, empty cells) from your data before you begin.

  • To merge data in Excel using this method, open your Excel files and, in the target Excel file for merging data, create a new worksheet by pressing the + (plus) button next to the sheet tabs at the bottom of the window.
  • In your new worksheet, press Data > Consolidate.
  • In the Consolidate window, make sure that Sum is selected in the Function drop-down menu. Click the button next to the Reference entry box to begin selecting your first data set—this is the data you wish to merge. You can also type the reference to the cell range in yourself, if you’d prefer.
  • To select the data using your mouse, click on the sheet containing your worksheet once the Consolidate – Reference box is visible, select the data, then press the Insert button.
  • The cell range will appear in the Reference entry box—click the Add button to add it to the All References list.
  • Repeat the steps above to select additional sets of data, clicking Add to add each set to your sheet. If your data has column or row labels, make sure that these are processed correctly by pressing the Top row or Left column checkboxes in the Use labels section.
  • If you want to continue to edit the data in the original, separate worksheets, click to enable the Create links to source data checkbox. This will ensure that any changes to your original data are reflected in your merged sheet later.
  • Once you’re ready to merge your data into a single sheet, press the OK button.
  • Your merged data will appear, with an options menu next to the row labels to be able to switch between different data views—click on these options (for instance, the 1 button) to hide or view the data you’ve merged in part or in full.

If you choose to create links to the source data, your new worksheet will act as a mirrored version of your separate sheets and files. Otherwise, your data will be copied into this sheet for you to edit directly.

Using Merged Excel Data

Whether you decide to merge data in Excel into a single sheet or a file, or if you prefer to spread your working across multiple files, these tips should help you to keep organized. When you’re ready, you can begin to share your Excel file with others to collaborate and analyze your data effectively as a team.

If you’re worried about losing track of changes to your merged data, don’t worry—you can track changes in Excel easily using its built-in tracking feature. 

Let us know your Excel data analysis tips in the comments section below.

In this blog, we would learn how to merge data in excel from two or more different tables using the Excel Power Query feature.

Difference Between Merge and Append Data in Excel

Merging Data and Appending Data are two different terms and are used for two different purposes. By merging tables in Excel, it means combining two or more excel tables and create one table based on unique records (key field). Whereas, by appending tables in excel, it means to put the table data from two or more excel tables one below the other. It is important to keep in mind that in order to append the tables in excel, the column headers in all the tables should be the same.

Table of Contents

  1. Difference Between Merge and Append Data in Excel
  2. Sample Data for Merging Data in Excel
  3. Step by Step Guide To Merge Data in Excel
    1. Get Table from Excel File and Store it As Connections
    2. Merging Power Query Connections to Create One Table
  4. What is So Special About Power Query

Sample Data for Merging Data in Excel

Suppose we have three tables, as shown in the image below:

Sample Table to Merge Table in Excel

The first table shows the region-wise number of units sold per material during the month of December 2020. The second one shows the respective material code against the material number. And the third table shows the sales officer’s name deployed in each of the five regions.

Now, we want to create one single table using these three tables. The new table should contain the following columns – Date, Material, Material Code, Region, Sales Officer, and Unit Sold.

Step by Step Guide To Merge Data in Excel

In order to merge data tables in excel, there are two main activities involved:

  1. Firstly, to store the three tables as connections
  2. Merge the connections to create a new table in excel

Let us deep dive into each of these and learn the technique of merging data tables in excel using poower query.

Get Table from Excel File and Store it As Connections

In order to use the get data from a table into the power query, it is must that the dataset table should be a proper excel table. To convert a normal tabular dataset into an excel table, simply select any of the cells within the dataset area, and use keyboard shortcut Ctrl + T. You can find more details about excel table format in this link.

Now, follow the below steps to create connections for tables in power query.

  • Select any of the cells in the first table and navigate to the ‘Data’ tab > ‘Get & Transform Data’ group > ‘Get Data’ > ‘From Other Sources’ > ‘From Table/Range’ as shown below:
Get Data From Table Range Navigation
  • As a result, a new window named ‘Power Query Editor’ will pop out on your screen showing the data records of the first table.
  • In this window, simply go to Home Tab > Close & Load > Close & Load To as shown below:
Close and Load To Navigation
  • In the dialog box that appears, select the option – ‘Only Create Connections’ radio button and click OK, as shown in the image below:
Only Create Connections Import Data
  • As a result, excel would create a connection for the selected table (the first table). You can check this connection in the ‘Queries and Connections’ pane on the right side of the excel work area.
Units Sold Table Connection Only

In a similar way, perform all the above steps and create connections for the other two tables (one by one) as well. Finally, you would have three connections listed in the ‘Queries and Connections’ pane, as shown below:

Tables Stored As Connections

If you are not able to see the ‘Queries and Connections’ pane (image above) in the excel or it is by mistake closed, then you can bring it back by navigating to ‘Data’ Tab > ‘Connections’ group > ‘Queries and Connections’

Merging Power Query Connections to Create One Table

Once we have stored the tables in the form of connections, now we are ready to merge these connections. Follow the undermentioned steps:

  • In the ‘Queries and Connections’ pane, right-click on the ‘Units_Sold’ connection and select the option ‘Merge’.
Right Click Connections to Merge
  • In the ‘Merge’ dialog box that appears, select the tables ‘Unit_Sold’ and ‘Mat_Code’, as shown below. You can select only two tables at a time for joining.
Merge Dialog Box Power Query
  • The next step is to select the lookup unique columns. In our case, the lookup column is – ‘Material’. Click on the column headers ‘Material’ in both the tables. Finally, click on ‘OK’ as shown below:
Unique Column Selection Power Query
  • As a result, excels opens up the ‘Power Query Editor’ window. In this window, now you have the new column ‘Mat_Code’ added to the table. Simply, click on the two-side facing arrow on the column header. In the drop-down window that appears, uncheck the checkbox for ‘Material’ and click OK.
Two Side Faced Arrow Power Query
  • Finally, you can see the material codes listed against respective materials.
Material Code against Material
  • Now, load this table again, as a new connection by navigating to the ‘Home’ tab > ‘Close & Load’ > ‘Close & Load To’ > ‘Only Create Connection’ > OK. As a result, excel creates a new connection for it (as highlighted below).
New Merged Connection

Now, perform all the above steps to merge this new connection table ‘Merge1’ with the ‘Sales_Officer’ table. As a result of this, you would have a final table ready with you having the new column ‘Sales Officer’, as shown below:

Sales Officer Column Added

Let us finally, load this table to excel. To do so, Home tab > Close & Load.

Power Query Editor - Close & Load Icon

That’s it, excel would create a new worksheet with the final data table loaded to it. There are in total of 441 rows of data.

Merge Data in Excel Using Power Query

What is So Special About Power Query

The main reason why people choose to use the power query excel feature to import data to excel from other sources is that it is quite easy to use, and no complex coding knowledge is required.

However, apart from its user-friendly interface, the best part of the power query is that the connections stored here at reusable ones.

This means that in an event of any change in the source data table, the power query can incorporate those changes to the table at a click of a mouse.

Let me give you one example to support this. Suppose, I delete a few of the records from the first table – ‘Units_Sold’. Now, I want this change in the source table to get incorporated into the final merged table.

To do so, simply go to the final merged table, right click on any of the cell and select the option ‘Refresh‘.

Right Click Refresh Merged Table Power Query

As a result, excel would perform all the steps one by one and get the latest data.

With this we have completed with this blog on how to merge data in excel from two or more different tables.

RELATED POSTS

  • Combine or Merge All Text Files in Folder in Excel

  • Using Fill Down or Fill Up in Excel Power Query

  • How to Filter and Sort Data in Excel Power Query

  • 4 Ways to Refresh Power Query in Excel

  • Custom Columns in Table in Excel Power Query

  • How to Unpivot Data in Excel Using Power Query

If you ask people who work with data, you will get to know that combining Excel files or merging workbooks is a part of their daily work.

Agree?

A simple an example: Let’s say you want to create a sales report and you have data of four different zones in four different files.

Now:

The very first thing you need to do is to combine those files in one single workbook and only then you can create your report further.

The point is: You have to have a method which you can use for merging these files. Say “YES” in the comment section if you want to know the best method for this.

Today in this post, I’m going to share with you the best way to merge data from multiple Excel files into a SINGLE workbook.

But, here’s the kicker.

This post will teach you something you need to learn to use in the real world data problem so make sure to read the entire post.

The Best Possible Way for Combining Excel Files by Merging data into ONE Workbook — POWER QUERY

Power Query is the best way to merge or combine data from multiple Excel files in a single file. You need to store all the files in a single folder and then use that folder to load data from those files into the power query editor. It also allows you to transform that data along with combining.

It works something like this:

  1. Saving All the Files into a Single Folder
  2. Combining them using Power Quer
  3. Merging Data into a Single Table

Make sure to download these sample file from here to follow along and check out this tutorial to learn power query.

Note: For combining data from different Excel files, your data should be structured in the same way. That means the number of columns and their order should be the same.

To merge files, you can use the following steps:

  1. First of all, extract all the files from the sample folder and save that folder at the desktop (or wherever you want to save it).
    combine-data-from-multiple-files-into-one-workbook-by-merging-data-save-files
  2. Now, the next thing is to open a new Excel workbook and open “POWER Query”.
  3. For this, go to Data Tab ➜ Get & Transform Data ➜ Get Data ➜ From File ➜ From Folder.
    combine-data-from-multiple-files-into-one-workbook-by-merging-data-open-from-folder
  4. Here you need to locate the folder where you have files.
    combine-data-from-multiple-files-into-one-workbook-by-merging-data-locate-the-folder
  5. In the end, click OK, and once you click OK, you’ll get a window listing all the file from the folder, just like below.
    combine-multiple-files-into-one-workbook-using-power-query-listing-all-the-file
  6. Now, you need to combine data from these files and for this click on “Combine & Edit”.
    combine-multiple-files-into-one-workbook-using-power-query-combine-and-edit
  7. From here, the next thing is to select the table in which you have data in all the workbooks and yes, you’ll get a preview of this at the side of the window.
    combine-multiple-files-into-one-workbook-using-power-query-select-the-table
  8. Once you select the table, click OK. At this point, you have merged data from all the files into your power query editor and, if you look closely you can see a new column with the name of the workbooks from which data is extracted.
    combine-multiple-files-into-one-workbook-using-power-query-combine-data-in-editor
  9. So, right-click on the column header and select “Replace Values”.
    combine-multiple-files-into-one-workbook-using-power-query-right-click-replace-values
  10. Here in the “Value to Replace” enter the text “.xlsx” and leave “Replace With” blank (here idea is to remove the file extension from the name of the workbook).
    combine-multiple-files-into-one-workbook-using-power-query-enter-value-to-replace-1
  11. After that, double click on the header and select “Rename” to enter a name for the column i.e. Zone
    combine-multiple-files-into-one-workbook-using-power-query-rename-the-folder .
  12. At this point, your merged data is ready and all you need is to load it into your new workbook. So, go to the Home Tab and click on the “Close & Load”.
    combine-multiple-files-into-one-workbook-using-power-query-close-and-load

Now you have your combined data (from all the workbooks) into a single workbook.

This is the moment of JOY, write “Joy” in the comment section if you love to use “Power Query for combining data from multiple files”.

Important Point

In the above steps, we have used the table name to combine data from all the files and add all of it into a single workbook. But not all time you will have the same table name in all the Excel files and at that point, you can use the worksheet name as a key to summarizing all that data.

One more thing:

As I said, you can use a worksheet name to combine data with the power query but there are few more things which I want to share with you and you need to take care of those. Power Query is case sensitive, so when combining files make sure to have the name of worksheets in all the workbooks in the same letters.

The next thing is, to have the same name for the column headers, but here the kicker: The order of the columns doesn’t matter. If column1 in the north.xlsx is column2 in the west.xlsx, Power Query will match it, but you have to have column names the same.

So now, while combining files using power query you can use the worksheet name instead of the table name, and here you have «SalesData» as the worksheet name in all the files.

You select it and click on the «Combine & Edit» and follow all the steps which I have mentioned in the above method.

Why Power Query is the Best Way to Merge Data into a Single File?

Merge Data from Multiple Workbooks When you don’t have the Same Name for Worksheets and data in Tables

This is the hard truth…

…that in some situations, you won’t have the same name for worksheets and not all the data in tables all the time.

Now, what you should be doing in that case?

Well…

…in this case, you must know how you can combine data from all the files and I don’t want to miss to share with this thing with you.

…so without any further ado, let’s get started.

  • First of all, open the “From Folder” dialog box to locate the folder where you have all the files.
  • Now in this dialog box, locate the folder and click OK.

  • After that, click on the “Edit” to edit the table.

  • At this point, you will have a table like below in your power query editor.

  • Next, select the first two columns of the table and click on the “Remove Other Columns” from the right-click menu.

From here, we need to add a custom column to fetch data from the worksheets of the workbooks.

  • For this, go to Add Column Tab and click on the “Custom Column” button. This will open the “Custom Column” dialog box.

  • In the dialog box, enter =Excel.Workbook([Content]) and click OK.

…at this time you have a new column in the table but next, you need to extract data from it.

  • Now, open the filter from that newly added custom column and click OK to expand all the data into the table.

  • Here you have the newly expanded table with some new columns.
  • Now from this new table, delete all the columns except third and fourth.

  • So, open the filter for the column “Custom.Data” to expand it and click OK.

The moment you click OK, you’ll get all the data from all the files into a single table…

you need to make some changes into it to make it PERFECT.

If you notice, all the heading of the column are into data itself…

…so you need to add the column headings.

  • To do this, you need to double click on the header and add a name, or you can right click and select rename it.

The next you need to exclude the headings which you have in the data table.

  • Now open any column’s filter option and unselect the heading name which you have in the column data and click OK after that.

Now our data is ready to load into the worksheet, so, go to the Home Tab and click on the close and load.

Congratulations! you have just combined data from the different workbooks (with different worksheets name and without any table).

This is also important:

At this point, you have merged the data into one table.

But there’s one thing you need to do…

…and that’s applying some formatting to it and making sure that it won’t go away when you update your data.

Here’s what you need to do…

  • First of all, select the column where you have dates (as it is formatted as number right now) and format it as dates.
  • After that, make all the columns wide as per the data you have in them.
  • Here you can also format amount and price as “Currency”. 

But the next thing is to make this formatting fix.

  • For this, go to “Design Tab”, and open properties.
  • Untick “Adjust Column” width and tick mark “Preserve Cell Formatting”.
  • Yes, that’s it.

Now you have a query in your workbook which can combine data from multiple files…

…and merge it into a single workbook…

…even if the worksheet name is not the same or if you don’t have tables.

And yes, you have also made the formatting fix. ?

In the end,

As I said, POWER QUERY is real and if you frequently use to combine data from multiple files then you must use this method…

…as it’s a ONE-TIME setup.

The most important thing is you when you use power query you can even clean the data from those files as well.

I hope this tutorial will help you to Get Better at Excel. But now, you need to tell me one thing.

Which method do you use to combine data from multiple files?

Make sure to share your views with me in the comment section, I’d love to hear from you. And please, don’t forget to share this post with your friends, I am sure they will appreciate it.

You must Read these Next

  • Consolidate Data From Multiple Worksheets: This option can help you to combine data from multiple worksheets into a single one…
  • Unpivot Data using Power Query: In this situation, you need to put some efforts and spend your precious time to make it re-usable…
  • Create a Pivot from Multiple Files: In this post, I’d like to show you a 3 steps process to create a pivot table by using data from multiple…

About the Author

puneet one point one

Puneet is using Excel since his college days. He helped thousands of people to understand the power of the spreadsheets and learn Microsoft Excel. You can find him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.

Понравилась статья? Поделить с друзьями:
  • Merge columns to one column in excel
  • Merge column with excel
  • Merge cells pandas excel
  • Merge cells in one cell excel
  • Merge cells in excel text