Columnist

# Overcome a Nuance of Excel's Subtotal Feature

May 24th 2013
Columnist

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.

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 [email protected] or follow him on Twitter. David speaks at conferences about Microsoft Excel, and presents webcasts for several CPE providers, including AccountingWEB partner CPE Link.

Tags:

### Replies (6)

By Stephane
Jun 25th 2015 20:11 EDT

Works for me, thanks for the tip !

Thanks (0)
By David Ringstrom
Jun 25th 2015 20:11 EDT

You're welcome! I appreciate the feedback!

Thanks (0)
By Doug Masto
Jun 25th 2015 20:11 EDT

Excellent. Now if only I can remember this for the next time

Thanks (0)
By Damian
Jun 25th 2015 20:11 EDT

Extremelly useful, thanks a lot!

Thanks (0)