Overcome a Nuance of Excel's Subtotal Feature

By David Ringstrom, CPA

Many users rely on the Subtotal feature in Excel to instantly insert totals, averages, counts, or other statistics into a list. As you'll see, the feature is easy to use  until you want to copy or format just the total rows. In this article, I'll explain the nuance so that you'll be in complete control of this feature.
Figure 1 shows a typical data set for use with the Subtotal feature. We can use the Subtotal feature to insert a total after each product as well as a grand total at the bottom. As an added benefit, we'll then be able to expand and collapse our list by way of outlining buttons that will appear at the left. To do so:
  1. Select any cell within your list.
  2. Choose the Subtotal command on the Data tab in Excel 2007 and later, or the Data menu in Excel 2003 and earlier.
  3. Select the Cases Sold field, and then click OK.
Figure 1: Use the Subtotal feature to automate inserting totals within a list of data.
Figure 2 shows the newly inserted subtotals, along with outlining controls at the left-hand side of the worksheet. If you click the 1 button, the list will collapse down to just the total rows, as shown in Figure 3. 
Figure 2: The Subtotal feature inserted a total after each change in the Product column.
Figure 3: Click the 1 button to collapse the list down to just the total rows.
Click on cell A1 and then press Ctrl-A to select the contiguous block of data. Press Ctrl-C to copy, and then in a new worksheet, press the Enter key to paste your data. At this point the aforementioned nuance reveals itself. One would think Excel would copy and paste just the visible rows that contain the totals, but instead, Excel includes all of the rows, as shown in Figure 4. 
Figure 4: Even though we thought we copied just the total rows, Excel pasted all of the rows.
Similarly, any formatting that you apply would affect the hidden rows as well. Here's how to take charge of the situation:
  1. As shown in Figure 5, select the cells that you wish to copy or format.
  2. Press Ctrl-G to display the Go To dialog box and then click the Special button.
  3. Double-click Visible Cells Only.
Figure 5: Use the Go To Special command to select just the visible rows for copying or formatting.
At this point, you can copy or format just the total rows. You can access the Go To Special command in other ways as well:
  • In any version of Excel, press F5 instead of Ctrl-G.
  • In Excel 2007 and later, choose the Find & Select command on the Home Tab and then choose Go To Special.
  • In Excel 2003 and earlier, choose Edit, Go To, and then click the Special button.
N.B.: You don't need to use the Go To Special command with filtered lists (the Filter command in Excel 2007 and later, or the AutoFilter command in Excel 2003 and earlier). Only the visible rows are affected when you copy or format filtered lists, but with the Subtotal feature, the extra step of Visible Cells Only will help you keep your sanity.
Read more articles by David Ringstrom. 
About the author:

David H. Ringstrom, CPA heads up Accounting Advisors, Inc., an Atlanta-based software and database consulting firm providing training and consulting services nationwide. Contact David at david@acctadv.com or follow him on Twitter. David speaks at conferences about Microsoft Excel, and presents webcasts for several CPE providers, including AccountingWEB partner CPE Link.

You may like these other stories...

Regulatory compliance, risk management and cost-cutting are the big heartburn issues for finance execs in the C-suite. Yet financial planning and analysis—a key antacid—is insufficient.That's just one of the...
Continuing its efforts to simplify accounting procedures, the FASB has issued a proposed Accounting Standards Update on customer fees paid in a cloud computing arrangement. The newly-proposed update (Intangibles—...
How are you planning? What tools do you use (or fail to use) for forecasting? PlanGuru is a business budgeting, forecasting, and performance review software company based in White Plains, N.Y. AccountingWEB recently spoke...

Already a member? log in here.

Upcoming CPE Webinars

Aug 28
Excel spreadsheets are often akin to the American Wild West, where users can input anything they want into any worksheet cell. Excel's Data Validation feature allows you to restrict user inputs to selected choices, but there are many nuances to the feature that often trip users up.
Sep 9
In this session we'll discuss the types of technologies and their uses in a small accounting firm office.
Sep 11
This webcast will include discussions of commonly-applicable Clarified Auditing Standards for audits of non-public, non-governmental entities.
Sep 26
In this jam-packed presentation Excel expert David Ringstrom, CPA will give you a crash-course in creating spreadsheet-based dashboards. A dashboard condenses large amounts of data into a compact space, yet enables the end user to easily drill down into details when warranted.