How to Merge Excel Workbooks Into One
Below, we list the different methods for merging workbooks in Excel:
Method 1: Manual Merging
One approach to merging Excel workbooks is to do it manually. Although time-consuming, the manual method offers precise control over consolidation.
Here is a simple guide to follow:
Step 1: Open a new blank workbook for your main file.
Step 2: In the file, make a column for each financial metric.
Step 3: Open ‘Workbook1’.
Step 4: Copy everything from the ‘Workbook1’ sheet.
Step 5: Go back and paste it into the new worksheet.
Step 6: Next, do the same with ‘Workbook2‘.
Step 7: Make sure the data is formatted right.
While manual merging can be tedious, it allows you to thoroughly review the data during the consolidation process, ensuring accuracy and catching any potential issues.
Method 2: Using Excel’s Built-in Feature
Microsoft Excel offers a built-in feature that can streamline the merging process. The Consolidate function. The Consolidate feature enables you to merge information from various worksheets or workbooks into one location.
Here’s a simple guide on how to use the Consolidate function in Excel:
Step 1: Start by opening a new sheet in your main file and add the rows.
Step 2: Go to the ‘Data’ tab and hit ‘Consolidate’.
Step 3: In the box, pick the consolidation function you need (e.g., ‘Sum’ for adding financial metrics).
Step 4: Hit ‘Reference’,
Step 5: Choose the first workbook,
Step 6: Select data, then ‘Add’ and click ‘OK’.
Step 7: Do Step 4 for each workbook you’re consolidating.
The Consolidate function will create a new table with the consolidated data, automatically summing up the financial metrics from the selected workbooks.
Method 3: Using Excel’s Power Query
Power Query is a powerful data transformation and integration tool built into Excel. It is an excellent tool with a user-friendly interface for combining financial data from multiple sources.
Here’s how to use Power Query for merging:
Step 1: Open a new workbook and navigate to the ‘Data’ tab in the ribbon.
Step 2: Click on ‘Get Data’ and select ‘From File’ > ‘From Workbook’.
Step 3: Browse and select the Workbook 1.
Step 4: Select the financial data sheets in the Navigator window and click ‘Transform Data’.
Step 5: In the Power Query Editor, select ‘Append Queries’ from the ‘Home’ tab to combine the chosen sheets into a single table.
Step 6: Click ‘Close & Load’ to load the merged data into a new worksheet.
Step 7: Repeat steps 2-6 for Workbook2, appending its data to the existing table.
Power Query simplifies the merging process and provides a range of transformative functions to clean, reshape, and optimize your financial data. Its ability to handle complex datasets and automate repetitive tasks makes it a valuable tool for finance professionals.
Method 4: VBA Macros for Advanced Automation
For those with programming experience, VBA macros offer a powerful way to automate the merging process. By writing custom scripts, you can tailor the consolidation to your needs and handle complex data structures.
Here’s a sample macro that automatically merges financial data from multiple workbooks:
Sub MergeWorkbooks()
Dim mergeWb As Workbook
Dim sourceWb As Workbook
Dim ws As Worksheet
Set mergeWb = ThisWorkbook
For Each ws In mergeWb.Worksheets
ws.UsedRange.ClearContents
Next ws
Dim filePath As String
filePath = “C:\Finance\Data\”
Dim fileName As String
fileName = Dir(filePath & “*.xlsx”)
Do While fileName <> “”
Set sourceWb = Workbooks.Open(filePath & fileName)
For Each ws In sourceWb.Worksheets
ws.UsedRange.Copy mergeWb.Sheets(ws.Name).Range(“A1”)
Next ws
sourceWb.Close False
fileName = Dir()
Loop
MsgBox “Workbooks merged successfully!”
End Sub
Save the file as a Macro-Enabled File (.xlsm) and re-open the Workbook.
Press ‘ALT+F8’ to run the macro.
The following macro performs the following tasks:
- It empties the master workbook’s sheets.
- It spots where the source books live.
- It goes through all Excel files in that spot.
- It opens each one, grabs the data, and puts it in the master book.
- It shuts the sourcebook without saving it.
- Keep going until it’s done with all the books in the folder.
You can automate the merging process using VBA macros, saving time and reducing the risk of manual errors. However, macro security in financial environments is essential, and your code must be thoroughly tested and approved before deployment.