Use Excel's built-in Subtotal command to automatically add subtotals and grand totals to a list of data. Show Subtotal VideoYou can watch the steps for creating subtotals, and preventing duplicate grand totals, in the Subtotal video, show below. The written instructions are below the video. Sort the DataBefore applying subtotals, the data must be sorted by the columns on which you want to base the subtotals. In this example, Category and Product will be subtotaled, so the data is sorted by those two columns. Apply the First SubtotalAfter the data is sorted, follow these steps to apply the first subtotal. In this example, the Category column will be subtotalled first.
The data will show a subtotal after each change in the Category column, and there will be a Grand Total at the bottom of the data. At the top left, grouping buttons are added, so you can view specific parts of the data: 1 - Grand Total only 2 - Grand Total and Subtotals 3 - All data and totals You can also click the + and - buttons in the grouping bar, to show or hide sections of the data. Apply the Second SubtotalNext, repeat the previous steps to apply the second subtotal. In this example, the Product column will be subtotalled second. Be sure to remove the check mark from "Replace current subtotals", so the Category subtotals are not removed. After the second subtotals are applied, the data will show a subtotal after each change in the Category column, and each change in the Product column, and there will be a single Grand Total at the bottom of the data. Another grouping button is added at the top left of the worksheet. Remove SubtotalsIf you no longer need the subtotals, follow these steps to remove them.
Duplicate Grand TotalsWith some data, a second Grand Total might appear, if you add a second layer of subtotals. This occurs if there are errors in the columns that are being totaled. In the screen shot below, there are two Grand Total rows, because there is an error in the Total Price column Prevent Duplicate Grand TotalsTo prevent duplicate grand totals, use the IFERROR function, or IF and ISERROR functions, to handle the errors. For example: =IFERROR(E2*D2,"") If you can't alter the formulas to prevent errors, you can hide the duplicate Grand Total rows, after creating the subtotals.Get the Sample FileClick here to get the sample file for Excel Subtotals. The zipped file is in xlsx format, and does not contain macros. More TutorialsPivot Tables SUBTOTAL Filtered List SUBTOTAL Function Functions List 30 Functions in 30 Days Last updated: July 11, 2021 7:35 PM
Outlining data makes your data easier to view. In this example we will total rows of related data and collapse a group of columns. 1. First, sort the data on the Company column. 2. On the Data tab, in the Outline group, click Subtotal. 3. Select the Company column, the column we use to outline our worksheet. 4. Use the Count function. 5. Check the Company check box. 6. Click OK. Result: 7. To collapse a group of cells, click a minus sign. You can use the numbers to collapse or expand groups by level. For example, click the 2 to only show the subtotals. Note: click the 1 to only show the Grand Count, click the 3 to show everything. To collapse a group of columns, execute the following steps. 8. For example, select column A and B. 9. On the Data tab, in the Outline group, click Group. 10. Click the minus sign above column C (it will change to a plus sign). Result: 11. To remove the outline, click any cell inside the data set and on the Data tab, in the Outline group, click Subtotal, Remove all.
Many spreadsheets are created in a hierarchical style. For example, a worksheet might contain a column for a person or company, followed by a column with sales data. By outlining your worksheets, you make them easier to understand and read. Instead of sifting through irrelevant information, you can collapse an outline to display each group’s bottom line. There are several ways to outline a workbook:
This lesson explains how to turn on the subtotals feature and then use the outline options to simplify the data view. Before you turn on subtotals, there are a few preliminary steps that must be completed. First, make sure your data is arranged into labeled columns. The data in each column must also be of the same type and it needs to be sorted based on the column you want to group the subtotals by.
Once subtotals are applied, the outline levels appear at the left. The outline allows you to collapse the detailed rows or columns and view only the subtotals.
The chart is moved to its own worksheet. |