Grouping worksheets allows a number of tasks to be performed similarly on all sheets in a group at the same time. For example, you could enter text in the same cell, name headers and/or footers, run spell check, or send to the printer for all grouped sheets at once.
Let's group the worksheets together so that we can quickly label all of the columns and rows and streamline the organization of data. Then, we will add data to the worksheets and explore a couple of ways to easily summarize the data across these sheets.
Step1. To select the worksheets to group,
Click the Jan tab, hold Shift key+Click the Mar tab
Step1. To enter the row labels starting in cell A1, type:
Item Enter Coffee Enter Tea Enter
Step2. To enter the column labels,
Click cell B1, type: Morning Tab key Afternoon Tab key Evening Enter
Step3. To move to the Feb worksheet,
Click the Feb worksheet tab
Step4. To enter the data for this worksheet, type:
10 Tab key 20 Tab key 30 Enter,
5 Tab key 10 Tab key 15 Enter
Item | Morning | Afternoon | Evening |
---|---|---|---|
Table showing data in Feb worksheet | |||
Coffee | 10 | 20 | 30 |
Tea | 5 | 10 | 15 |
Step5. To move to the Mar worksheet,
Click the Mar worksheet tab
Step6. To enter the data for this worksheet, type:
20 Tab key 30 Tab key 40 Enter,
10 Tab key 15 Tab key 20 Enter
Item | Morning | Afternoon | Evening |
---|---|---|---|
Table showing data in Mar worksheet | |||
Coffee | 20 | 30 | 40 |
Tea | 10 | 15 | 20 |
Step7. To return to the Jan worksheet,
Click the Jan worksheet tab
Step8. To enter the data for this worksheet, type:
1 Tab key 2 Tab key 3 Enter,
1 Tab key 2 Tab key 3 Enter
Item | Morning | Afternoon | Evening |
---|---|---|---|
Table showing data in Jan worksheet | |||
Coffee | 1 | 2 | 3 |
Tea | 1 | 2 | 3 |
Step9. Save the workbook, Grouped.xlsx.
Summarizing Data Across Worksheets
There are actually three different ways to summarize data across multiple worksheets, which could exist in multiple workbooks. Today, we'll look at a simpler example, where all of them are in the same workbook. All three possible ways still apply. The ways to summarize across multiple worksheets depend on what you are trying to do with the data, how the data is structured and organized, and whether you want the data to remain dynamic or if a snapshot of it is sufficient for your needs. The three ways to summarize data across worksheets are:
- Consolidate by category: when the row and column labels are the same, the items or number of items may be different from within the data sources, and you want to use some kind of summarizing function on the data (e.g., SUM, COUNT, AVERAGE,...).
- Consolidate by position: the data is very highly structured; row and column labels match exactly by wording and position, and the data within them is arranged in the same order and position. Use this if the data sources all used the same template, and you want to use some kind of summarizing function on the data (e.g., SUM, COUNT, AVERAGE,...). There should be no blank rows or columns in your data.
- Use a formula: the most flexible method, but requires the most effort.
Which method you use will depend on your own data and needs. Let's add a worksheet to this workbook, and use the consolidate by position option in that new worksheet.
Step1. To create a new worksheet in the workbook,
Click
Step2. To begin to change the worksheet name,
Double-Click the Sheet# worksheet tab name
Step3. To rename the worksheet, type:
Cons Enter
Step4. To reposition the Cons worksheet to the end,
Press & Drag the Cons worksheet tab to the right of the Mar worksheet tab
Step5. To move the active cell, if necessary,
Click cell A1
Consolidating Data by Position
By grouping the worksheets to create their structure, the result is similar to if we had used a template: the data is all in the same order and position across the worksheets, and the row and column labels all match exactly. This means we can use consolidate by position to obtain a summary of all the data in the first three worksheets.
Let's see how to do this.
Step1. Switch to the Data command tab.
Step2. To begin to consolidate the data, in the Data Tools group,
Click
NOTE for MacOS Users: The appearance of the contents of the Consolidate dialog box is slightly different, but the functionality is the same.
Step3. To begin to specify the first desired data range, in the Reference field,
Click
Step4. To select the desired data range,
Click the Jan tab, Press & Drag the range A1:D3, Click
NOTE for MacOS Users: To make the selected range appear in the "All references:" field, Click.
Step5. To confirm this range as a data selection,
Click
Step6. Repeat steps 3-5 to add the ranges for the Feb and Mar worksheets.
Step7. To specify the location of the desired labels in the selected references, near the bottom of the dialog box,
Click the Top row checkbox, Click the Left column checkbox
8. To confirm all of these changes,
Click
Item | Morning | Afternoon | Evening |
---|---|---|---|
Coffee | 31 | 52 | 73 |
Tea | 16 | 27 | 38 |
Step9. Save the workbook, Grouped.xlsx.
Consolidating Data with a 3-D Formula
We can analyze data in the same cell (or range) on multiple worksheets within a workbook by using a 3-D reference in a formula. The syntax for a 3-D reference begins with the range of worksheet names, followed by the cell or range reference. If we had a workbook with four worksheets named Sheet1, Sheet2, Sheet3, and Sheet4, and we wished to add up the contents of the cells B3 on just the last three sheets, we would use the formula =SUM(Sheet2:Sheet4!B3). A 3-D formula can be used with many common functions, including SUM, AVERAGE, COUNT, MAX, MIN, and others.
Let's use a 3D formula to confirm the result of the Consolidate feature. First, we'll use a formula to replicate the row and column labels. We'll start our formula in cell B5.
Step1. Move the active cell to cell B5.
Step2. To create a formula linking cell B5 to the contents of cell B1, type:
=B1 Enter
Step3. Copy the formula in cell B5, and paste it into the range B5:D5.
Step4. Copy the formula in cell B5, and paste it into the range A6:A7.
Step5. To create a 3D formula in cell B6, type:
=sum(Jan:Mar!B2 Enter
Step6. Copy the 3D formula in cell B6, and paste it into the range B6:D7.
Step7. Switch to the Feb worksheet.
Step8. To change the value in cell B2,
Click cell B2, type: 50 Enter
Step9. Switch to the Cons worksheet.
Updating Consolidated Data Manually
Step1. To select the range and labels using the consolidate feature, on the Cons worksheet,
Press & Drag the range A1:D3
Step2. To begin to manually update the consolidated range, on the Data tab, in the Data Tools group,
Click
Step3. To update the data in the references,
Click
NOTE: Performing this process for manually updating the consolidated range may also be used to change the status of the "Create links to source data" checkbox, if desired.
Step4. Save the workbook, Grouped.xlsx.
Grouping for Consistent Headers or Footers
In addition to creating a consistent structure on multiple worksheets at the same time, grouping worksheets allows you the ability to quickly create custom headers or footers across the entire group of worksheets.
Since we began today with a new workbook, it does not have anything in the header. Let's group the worksheets together, and create the same custom header on all of them at once.
Step1. To select the worksheets to group, on the tabs at the bottom of the workbook,
Click the Jan tab, hold Shift key+Click the Cons tab
NOTE: If you have several worksheets, the Control key or the Command key can be used to select multiple individual worksheets to be grouped.
Step2. To view the headers in Print Preview, on the Ribbon,
Click the File tab, Click Print
NOTE for MacOS Users: To view the headers in Print Preview, on the Menu bar, Click File, Click Print...
Step3. To preview a different worksheet, below the print preview,
Click
NOTE: Your total number of pages may vary.
Step4. To exit the Print Preview and leave the Backstage view,
Click
NOTE for MacOS Users: To exit the Print dialog, Click Cancel.
Step5. Verify the worksheets are still grouped, and group them, if necessary.
Step6. To access the worksheets' headers,
Click the Insert tab, Click
Step7. To add the current date to the header,
Click in the left section, Click
Step8. To add the current time to the header, press:
Spacebar, then Click
Step9. To add the worksheet name to the right section of the Header,
Click in the right section, Click
NOTE for MacOS Users: To continue, you must move the active selection from the Header area, Click anywhere in the data area of the worksheet.
Step10. To preview the headers, on the Ribbon,
Click the File tab, Click Print
NOTE for MacOS Users: To view the headers in Print Preview, on the Menu bar, Click File, Click Print...
Step11. To exit the Print Preview and leave the Backstage view,
Click
NOTE for MacOS Users: To exit the Print dialog, Click Cancel.
Step12. To return to regular view of the workbook, on the Ribbon,
Click the View tab, Click Normal
Step13. To ungroup the worksheets,
Click any worksheet tab
Step14. Save the workbook, Grouped.xlsx.
NOTE: Another way to accomplish what we have done by grouping worksheets is by using a macro. For more information on creating and working with macros, consider attending the IT Training workshop Excel 2016: Basic Automation Using Macros.