Excel Tutorial: How To Merge Two Files In Excel


When working with data in Excel, you may often find yourself needing to merge two files to consolidate information. Merging files in Excel involves combining data from multiple worksheets or workbooks into one. Whether you're a student, professional, or business owner, knowing how to merge files in Excel can save you time and effort in organizing and analyzing data.

Key Takeaways

  • Merging files in Excel involves combining data from multiple worksheets or workbooks into one.
  • It is important to ensure that the column headers match in both files when merging data in Excel.
  • Using the 'Consolidate' function or Power Query can help in merging files efficiently.
  • Removing duplicate rows is an essential step in the merging process to maintain data accuracy.
  • After merging, it is crucial to save the file in the appropriate format and location for future use.

Understanding the data

Before merging two files in Excel, it is crucial to have a clear understanding of the data in each file. This includes identifying the files, ensuring column header alignment, and checking for any discrepancies in the data.

A. Identify the two files you want to merge

Start by identifying the two files that you want to merge. This could be in the form of Excel workbooks or CSV files. It is important to have a clear understanding of the data structure and content within each file before proceeding with the merge.

B. Ensure that the column headers match in both files

It is essential to ensure that the column headers in both files match. This includes the column names and the order in which they appear. If there are any discrepancies, it is advisable to make adjustments to ensure alignment before proceeding with the merge.

C. Check for any discrepancies in the data

Before merging the files, it is important to check for any discrepancies in the data. This could include missing or inconsistent data, duplicate entries, or formatting issues. Resolving these discrepancies before merging the files will help ensure the accuracy and integrity of the merged data.

Using the 'Consolidate' function

When you have two separate files in Excel that you need to merge, using the 'Consolidate' function can save you a lot of time and effort. Here's how you can do it:

A. Open Excel and navigate to the 'Data' tab

First, open your Excel spreadsheet and navigate to the 'Data' tab located at the top of the window. This is where you'll find the tools you need to merge your files.

B. Select the 'Consolidate' option

Once you're in the 'Data' tab, look for the 'Consolidate' option. It's usually located in the 'Data Tools' group. Click on this option to begin the merging process.

C. Choose the function that best suits your merging needs

After selecting the 'Consolidate' option, a dialog box will appear. In this box, you'll need to choose the function that best suits your merging needs. You have several options to choose from, such as sum, count, average, and more. Select the function that aligns with how you want to merge your data.

Merging files using Power Query

When working with Excel, there may be times when you need to merge two files to consolidate data for analysis or reporting purposes. Using Power Query, you can easily merge multiple files into a single dataset without the need for complicated formulas or manual data manipulation.

A. Importing the files into Power Query
  • Step 1: Open Excel and navigate to the 'Data' tab.

  • Step 2: Click on 'Get Data' and select the appropriate option to import your files (e.g., 'From File' > 'From Workbook').

  • Step 3: Choose the files you want to merge and load them into the Power Query Editor.

B. Combining the files using the 'Merge Queries' option
  • Step 1: In the Power Query Editor, select the first table you want to merge.

  • Step 2: Click on the 'Home' tab and choose 'Merge Queries' from the 'Combine' group.

  • Step 3: Select the second table you want to merge and choose the common column to merge on.

  • Step 4: Choose the type of join (e.g., 'Left Outer' or 'Inner') and click 'OK' to merge the tables.

C. Reviewing and adjusting the merged data
  • Step 1: After merging the files, review the resulting dataset to ensure the data is combined correctly.

  • Step 2: Use the Power Query Editor to make any necessary adjustments, such as renaming columns, removing duplicates, or filtering out irrelevant data.

  • Step 3: Once you are satisfied with the merged data, load it back into Excel for further analysis or reporting.

Removing duplicate rows

When merging two files in Excel, it's essential to remove duplicate rows to ensure data accuracy and clean up the merged file. Here's how to do it:

A. Utilizing the 'Remove Duplicates' function
  • Step 1: Open the merged Excel file that contains the two files you want to merge.
  • Step 2: Select the entire dataset or the specific range of cells where you want to remove duplicate rows.
  • Step 3: Go to the 'Data' tab on the Excel ribbon.
  • Step 4: Click on the 'Remove Duplicates' option in the 'Data Tools' group.

B. Choosing the appropriate columns for duplicate removal
  • Step 5: In the 'Remove Duplicates' dialog box, choose the columns that you want to use for identifying duplicate rows. You can select all columns or specific ones based on your merging requirements.
  • Step 6: Click 'OK' to apply the duplicate removal based on your column selections.

C. Confirming the removal of duplicate rows
  • Step 7: Once the 'Remove Duplicates' process is completed, Excel will display a message indicating the number of duplicate rows removed and the number of unique records remaining.
  • Step 8: Review the dataset to ensure that the duplicate rows have been successfully removed, and the merged file now contains clean, unique data.

Saving and exporting the merged file

Once you have successfully merged the two files in Excel, the next step is to save and export the merged data. This ensures that you have a copy of the merged file for future use or sharing with others. Here’s how you can do it:

A. Choosing the file format for the merged data
  • Excel Workbook (.xlsx): This is the default file format for Excel. It is compatible with most spreadsheet software and is ideal for preserving the formatting and formulas used in the merged file.
  • CSV (Comma-Separated Values): If you want to use the merged data in a different program or share it with someone who doesn’t have Excel, saving the file as a CSV can be a good option. However, keep in mind that this format does not support multiple sheets or cell formatting.

B. Selecting the location to save the merged file

Before saving the merged file, you need to choose where you want to save it on your computer or external storage device. Click on ‘File’ in the top menu, then select ‘Save As’ to choose the location and give the file a name.

C. Confirming the successful merge and save

After saving the merged file, it’s important to double-check that the data has been saved correctly. Open the saved file and review the content to ensure that all the merged data is present and accurately merged. This step is crucial to avoid any potential data loss or errors in the merged file.


Recap: Merging files in Excel can be a handy tool for combining data from multiple sources into a single, organized file. By using the "Consolidate" or "Power Query" feature, you can easily merge two files into one, making it easier to analyze and work with the data.

Importance: It is crucial to pay attention to detail when merging files in Excel, as any mistakes or omissions could result in inaccurate data. Taking the time to carefully review the merging process and double-checking the results can save you from potential errors and frustration in the long run.

Encouragement: As with any new skill, practice makes perfect. By regularly merging files in Excel, you can become more comfortable with the process and increase your efficiency in handling data. Don't be afraid to experiment and familiarize yourself with the different merging techniques to become a proficient Excel user.

Excel Dashboard

ONLY $99

    Immediate Download

    MAC & PC Compatible

    Free Email Support

Related aticles