While working in Excel, we often have to work with a lot of worksheets in a workbook. Today I will be showing how you can pull data from multiple worksheets to a single worksheet in Excel.
Download Practice Workbook
4 Suitable Methods to Pull Data from Multiple Worksheets in Excel
Here we have three worksheets in a workbook. They contain the sales record of some items over three months: January, February and March respectively.
Our objective today is to pull data from these three worksheets into a single worksheet to use for calculation.
1. Use Formula to Pull Data from Multiple Worksheets
If you want to perform any operation on the data from multiple sheets, you can perform this through formulas. Here is how to do that.
Steps:
- Place the name of the sheet (Sheet_Name!) before the cell reference when there are cell references of multiple sheets in a formula.
- Let’s try to find out the total number of each product sold in the three months.
- Select any cell in any worksheet and enter the formula in this way:
=January!D5+February!D5+March!D5
- Then drag the Fill Handle to copy the formula to the rest of the cells.
See, we have got the total sales of three months for each product.
Formula Explanation:
- Here January!D5 indicates the cell reference D5 of the sheet name “January”. If you have the sheet name as Sheet1, use Sheet1!D5 instead.
- Similarly February!D5 and March!D5 indicate the cell reference D5 of the sheet named February and March respectively.
- Thus you can pull data from multiple sheets into one formula in a single sheet and perform any desired operation.
Using a 3D Reference Formula:
You can also do this by using a formula with a 3D reference. The formula is as follows.
=SUM(January:March!D5)
Click on this link to learn how to create a 3D reference in Excel.
Read More: Pull Same Cell from Multiple Sheets into Master Column in Excel
2. Pulling Data from Multiple Worksheets by Using Consolidate Feature
We can pull data from multiple worksheets and use them in an operation using the Consolidate tool from the Excel toolbar.
Steps:
- Create a blank dataset with the product names and add a column named Total Sales. Keep the cells under this column blank.
- Now, C5:C19 range of cells in any worksheet and go to the Data > Consolidate tool under the Data Tools section.
- You will get the Consolidate dialogue box. Under the option Function, select the operation you want to perform on the data from multiple worksheets.
- For the sake of this example, select Sum.
- Now, click on the Import icon right to the Reference box.
- The Consolidate box will be compressed to Consolidate – Reference box. Select the desired range of cells from the first sheet. Then again click the Import icon to the right.
- You will find the cell reference of the selected range inserted in the Reference box. Click the Add button right to the Add references box.
- You will find the references of the selected range inserted in the Add references box.
- Select the other ranges of cells from the other worksheets and insert them in the Add references box in the same way.
- For the sake of this example, select D5:D19 from the worksheet February and D5:D19 from the worksheet March.
- Then click OK. You will find the sum of the three selected ranges from three worksheets inserted in the empty range.
Read More: Excel Macro: Extract Data from Multiple Excel Files (4 Methods)
Similar Readings
- How to Enter Same Data in Multiple Sheets in Excel
- VBA Code to Convert Text File to Excel (7 Methods)
- How to Import Text File with Multiple Delimiters into Excel (3 Methods)
- Convert Notepad to Excel with Columns (5 Methods)
- How to Extract Data from Image into Excel (With Quick Steps)
3. Using Macros to Pull Data from Multiple Worksheets
Until now, we have pulled data from multiple worksheets to perform some operations.
What to do if we do not want to perform any operation, only collect data from multiple worksheets and arrange them vertically in one worksheet?
Look at the data set below.
Here we have a new workbook with three worksheets, each having the sales record of four weeks of the months of January, February, and March respectively.
Our objective is to collect data from these three worksheets and arrange them in one worksheet. We can execute this by running the following Macro (VBA Code).
The VBA code is as follows.
Sub PullDatafromMultipleSheets()
Dim Q As Long
Dim aRng As Range
On Error Resume Next
Worksheets.Add Sheets(1)
ActiveSheet.Name = "VBA"
For Q = 7 To Sheets.Count
Set aRng = Sheets(1).UsedRange
If Q > 7 Then
Set aRng = Sheets(1).Cells(aRng.Rows.Count + 1, 1)
End If
Sheets(Q).Activate
ActiveSheet.UsedRange.Copy aRng
Next
End Sub
This site helped us understand and develop the code.
Now, follow the steps below to apply this code.
Steps:
- First, press Alt+F11 and go to the VBA editor.
- Now, go to the Insert tab and click on Module. A new module will be opened.
- Now, copy the code and paste it here.
- Now, save the Excel file by pressing Ctrl+S.
- So you will face the following window first.
- Click on No and save the file as a Macro-Enabled file.
- Now, click on the Run button/press F5 or press Alt+F8.
- A dialogue box called Macro will appear. Select this Macro (PullDatafromMultipleSheets) and click on Run.
- You will find the data from the three worksheets arranged vertically in a new worksheet called “VBA”.
Read More: How to Pull Data from Multiple Worksheets in Excel VBA
4. Using Power Query to Pull Data from Multiple Worksheets
This is our final task today. Again we are back to our initial sheets to show this method. Our objective is to collect data from these worksheets and merge them into a single table.
We will accomplish this using the Power Query of Excel. Power Query is available from Excel 2016. If you use any older version, you have to download and install it manually.
Steps:
- First of all, we have to convert our data in each sheet into tables. Select any cell inside the data and press Ctrl+T. Then press OK.
- Now, go to Data > Get Data tool under the Get & Transform Data section from any worksheet.
- Click on the drop-down menu. From the available options, choose From Other Sources > Blank Query.
- The Power Query Editor will open. In the Formula bar, write this formula:
=Excel.CurrentWorkbook()
Power Query is case-sensitive. So write the formula as it is.
- Click on Enter. You will find the three tables from the three worksheets arranged one by one. Select the ones that you want to pull.
- For the sake of this example, select all three.
- Then click the small right arrow beside the title Content.
- You will get a small box. Click on Expand and then check (put a tick on) all the boxes.
- Then click OK. You will find all the items from three tables brought to a single table in Power Query Editor.
- Then go to File > Close and Load To… option in the Power Query Editor.
- You will get the Import Data dialogue box. Choose Table.
- Then if you want the combined table to be in a new worksheet, choose New Worksheet.
- Otherwise, choose Existing Worksheet and enter the cell reference of the range where you want the table.
- Then click OK. You will find the data from the three worksheets arranged in a single table in a new worksheet named Query.
Read More: How to Pull Data From Another Sheet Based on Criteria in Excel
Conclusion
Using these methods, you can pull data from multiple worksheets to a single worksheet in Excel. Do you have any questions? Feel free to ask us in the comment section.
Related Articles
- How to Extract Data from Excel Sheet (6 Effective Methods)
- Extract Filtered Data in Excel to Another Sheet (4 Methods)
- How to Pull Values From Another Worksheet in Excel
- Excel VBA: Pull Data Automatically from a Website (2 Methods)
- How to Import Data into Excel from Another Excel File (2 Ways)
- How to Get Data from Another Sheet Based on Cell Value in Excel