Chapter 7: Automate Repetitive Database Tasks
6.8 Group and Outline Data
Excel can group related data records together and then allow you to switch between the indi- vidual data records or summarized data with the click of a button. For example, you may have several sets of individual sales records sorted by sales transaction date. After each set of sales records, you could insert a row in the spreadsheet with the sales total. You can then group and outline the sales records so that you can easily switch between the individual sales records and the sales total with the click of a button.
■ Tip Grouping and outlining data records is slightly different than subtotaling data records. Grouping and outlining data records works best when you have already summarized the data. If you did not have the sales total already created in the preceding example, you could use Excel’s subtotaling feature to first create the subtotal and then outline the data.
Quick Start
To group and outline data records, click Data ➤(Outline) (in Excel 2007) or Data ➤Group and Outline (in Excel 2003), and then click one of the menu commands to do the following:
• Hide or display an already grouped set of data records.
• Group or ungroup selected data records.
• Have Excel automatically group and outline selected data records.
• Remove grouping and outlining for selected data records.
• Control grouping and outlining behavior for selected data records.
How To
To group and outline data records in Excel 2007, click Data, and in the Outline group, do the following:
1. Click Hide Detail or Show Detail to hide or display an already grouped set of data records related to the currently selected data record.
2. Click Group or Ungroup to manually group or ungroup the selected set of data records.
3. Click Group ➤Auto Outline to have Excel automatically group and outline the selected set of data records, based on how the data records are already summarized.
4. Click Ungroup ➤Clear Outline to remove grouping and outlining for the selected set of data records.
5. Click Outline to control grouping and outlining behavior through the Settings dialog box:
a. In the Direction area, check the Summary Rows Below Detail check box and/or the Summary Columns to Right of Detail check box to specify whether the data record summaries are listed below and/or to the right of the individual data records.
b. Select the Automatic Styles check box to have Excel apply cell formats, such as making the text of each summarized total bold, at the same time that the data records are grouped and outlined.
c. Click the Apply Styles button to have Excel apply cell formats to data records that are already grouped and outlined.
In Excel 2003, click Data ➤Group and Outline, and then do the following:
1. Click Hide Detail or Show Detail to hide or display an already grouped set of data records related to the currently selected data record.
2. Click Group or Ungroup to manually group or ungroup the selected set of data records, respectively.
3. Click Auto Outline to have Excel automatically group and outline the selected set of data records, based on how the data records are already summarized.
4. Click Clear Outline to remove grouping and outlining for the selected set of data records.
C H A P T E R 6 ■ A N A LY Z E D ATA 157
5. Click Settings to control grouping and outlining behavior through the Settings dialog box:
a. In the Direction area, check the Summary Rows Below Detail check box and/or the Summary Columns to Right of Detail check box to specify whether the data record summaries are listed below and/or to the right of the individual data records.
b. Select the Automatic Styles check box to have Excel apply cell formats, such as making the text of each summarized total bold, at the same time that the data records are grouped and outlined.
c. Click the Apply Styles button to have Excel apply cell formats to data records that are already grouped and outlined.
Try It
In this exercise, you will practice grouping and outlining data records related to the number of shipping containers inspected in a country’s regional seaports by month.
If the Excel workbook file is not open from the previous exercise, open it:
1. Start Excel.
2. Click Office Button ➤Open (in Excel 2007) or click File ➤Open (in Excel 2003), browse to and select the ExcelDB_Ch06_06-12.xls file, and click Open.
Group the data manually:
1. On the GroupOutline worksheet, select rows 2 through 13.
2. In Excel 2007, click Data ➤(Outline) Group. In Excel 2003, click Data ➤Group and Outline ➤Group.
3. Repeat steps 1 and 2 for rows 15 through 26, rows 28 through 39, and rows 41 through 52.
4. In the outline area (the column to the left of the row numbers), click the 1 button. The details are hidden and only the totals are displayed. Click the 2 button to see the details again.
5. Clear the manual groupings by clicking cell A1 and in Excel 2007, click Data ➤(Out- line) Ungroup ➤Clear Outline. In Excel 2003, click Data ➤Group and Outline ➤Clear Outline.
Now, group and outline more quickly by having Excel do it for you automatically. Click Data ➤(Outline) Group ➤Auto Outline (in Excel 2007) or Data ➤Group and Outline ➤Auto Outline (in Excel 2003). Excel detects that rows 14, 27, 40, and 53 contain SUM worksheet val- ues and automatically groups the related detail cells.