Using Subtotals in an Excel List
When working with a list, you often need to know the bottom line figures or totals. A list of sales records may include the names of all salespersons, the different products they have sold, and the units of each product sold. To get a better idea of each person’s performance by product, you can use the Subtotals command to get a subtotal for each product sold by each salesperson.
Using Automatic Subtotals
Inserting automatic subtotals is a quick way to summarize data in a list. To use automatic subtotals, your data must be organized into a list and sorted by the column for which you want to display subtotals. For example, in a list of sales records, you sort by salesperson to obtain the subtotals for the number of product units sold by each salesperson.
You determine how you want to subtotal your data using the Subtotal dialog box, shown in Figure 1-19. The options available in the Subtotal dialog box are summarized in Table 1-1.
For hands-on Microsoft Excel training classes in Los Angeles call us on 888.815.0604.
At Each Change In | Function |
At Each Change In | Identifies the field that contains the items by which you want to subtotal values in other columns. |
Use Function | Identifies the summary function used to calculate subtotals. |
Add Subtotal To | Identifies the fields you wish to subtotal. |
Replace Current Subtotals | Displays new subtotal rows. |
Page Break Between Groups | Inserts a page break between each grouping. |
Summary Below Data | Adds subtotal rows below the groupings. |
Excel calculates subtotal values by using a summary function, such as Sum or Average. The grand total values are derived from the detail data, which is the list data, and not from the subtotal rows. Grand total values are calculated by using the same summary function that you use to calculate subtotal values. Both grand total and subtotal labels are displayed in bold in the list and are automatically recalculated as you edit detail rows.
Method
To display automatic subtotals:
- Sort the list by the column for which you want to display subtotals.
- If necessary, select a cell in the list.
- In the Outline group on the Data tab, click the Subtotal button.
- In the Subtotal dialog box, from the At each change in drop‑down list, select a field.
- From the Use function drop-down list, select a subtotal function.
- In the Add subtotal to list box, select the desired subtotal field check box(es).
- If necessary, select the Replace current subtotals and Summary below data check boxes, and deselect the Page break between groups check box.
- Choose OK.
To remove automatic subtotals:
- In the Outline group on the Data tab, click the Subtotal button.
- In the Subtotal dialog box, choose Remove All.
Exercise
In the following exercise, you will use automatic subtotals in a list.
- Select the Ice Cream Sales worksheet.
- Sort the list first by Salesperson and then by Product, both in ascending order.
- In the Outline group on the Data tab, click the Subtotal button. [The Subtotal dialog box appears].
- In the At each change in drop-down list box, make sure Salesperson is selected.
- In the Use function drop-down list box, make sure Sum is selected.
- In the Add Subtotal to list box, select the Units, Price/Unit, and Sales check boxes, deselecting other check boxes as necessary.
- Make sure the Replace current subtotals and Summary below data check boxes are selected, and the Page break between groups check box is deselected.
- Choose OK. [Automatic subtotals are inserted for each salesperson].
Working with Subtotal Outline Symbols
When you use automatic subtotals, various subtotal outline symbols are displayed to the left of the worksheet, as illustrated in Figure 1-20. You click the appropriate detail symbols to hide or show rows of detail data. Excel automatically outlines your list by grouping detail rows with each associated subtotal row and by grouping subtotal rows with the grand total row.
You can also hide or show details for all subtotal groups at once by using the row level symbols. The level 1 symbol hides all levels of data except the grand total rows. The level 2 symbol hides all levels of data except the subtotal and grand total rows. The level 3 symbol shows all the data.
Method
To hide the detail rows of an automatic subtotaled list:
- Click the hide detail symbol beside the subtotal group.
- To show the detail rows of an automatic subtotaled list:
- Click the show detail symbol beside the subtotal group.
- To show different levels of detail in an automatic subtotaled:
- Click the appropriate level symbol.
Exercise
In the following exercise, you will work with subtotal outline symbols.
- To the left of row 13, click the hide detail symbol for Cattapan Total. [The detail data for Cattapan is hidden. Only the subtotal row for Cattapan is visible].
- To the left of row 22, click the hide detail symbol for DeMarcos Total. [The detail data for DeMarcos is hidden. Only the subtotal row for DeMarcos is visible].
- Click the row level 2 symbol. [Only the subtotal rows in the list are displayed].
- Click the row level 1 symbol. [Only the grand total row is displayed].
- To the left of row 59, click the show detail symbol for Grand Total. [The subtotal rows reappear].
- Click the row level 3 symbol. [All detail data, and the subtotal and grand total rows, are now visible].
Adding and Deleting Records Using the Data Form
If the existing subtotals do not show enough detail, you can insert a subtotal within a subtotal group, called a nested subtotal. For example, if your list shows the total number of products sold for each salesperson, you can add further detail to the list by adding subtotals for each individual product.
Method
To nest subtotals:
- In the Outline group on the Data tab, click the Subtotal button.
- In the Subtotal dialog box, from the At each change in drop-down list, select the field you want to use for the nested subtotal grouping.
- From the Use function drop-down list and in the Add subtotal to list box, select any new options for the new subtotal.
- Deselect the Replace current subtotals check box.
- Choose OK.
Exercise
In the following exercise, you will nest subtotals.
- In the Outline group on the Data tab, click the Subtotal button. [The Subtotal dialog box appears].
- From the At each change in drop-down list, select Product.
- Deselect the Replace current subtotals check box. [The Summary below data option is dimmed].
- Choose OK. [The Subtotal dialog box closes, and the new nested subtotals appear. A new row level symbol, 4, appears].
- Click the row level 3 symbol. [The detail data is hidden].
- Open the Subtotal dialog box.
- Choose Remove All, and then save and close the workbook. [All subtotals and outline symbols are removed].