By David Ringstrom, CPA
Did you know that you can streamline the AutoFilter feature in Excel 2003 and earlier versions? And that there are two ways to sum only the visible rows in your filtered list? Read on to discover these time saving techniques.
Not sure how to filter? Read Excel Filtering 101.
AutoFilter's Hidden Powers
Most users choose Data, Filter, and then AutoFilter to enable filtering in Excel. However, you can give yourself one-click access to the AutoFilter command:
- Choose Tools, Customize, and then click on the Commands tab.
- Choose Data from the Categories list, and then drag AutoFilter onto one of your toolbars, or to the right of the Help command.
- Drag the Show All command and place it to the right of the AutoFilter icon that you just dragged.
- Click Close to dismiss the Customize dialog box.
Figure 1: AutoFilter takes on special powers when you add it to a toolbar or your Excel menu.
You can now instantly filter a list based on the contents of the currently selected cell:
- Copy and paste the sample data from Table 1 into a blank worksheet, starting in Cell A1.
- Click on cell B14 — which contains the word green — and then click the AutoFilter button that you added above. As shown in Figure 2, your list should now show only green T-shirt sales.
- You can click the Show All command to keep the filtering arrows in place, but display all rows.
Caveat: AutoFilter only allows you to filter for a single value, such as the word green, so you'll still need to use the filter drop-down lists for more complex filtering. However, you can filter on one column at a time, such as green in column B, and then Medium in column A.
Figure 2: Use AutoFilter to create a summary with just two mouse clicks.
Important: Although the toolbar-based AutoFilter button turns on the arrows, you must still choose Data, Filter, and then AutoFilter to turn off the arrows.
Analyze Visible Rows
Now let's look at two ways to analyze data as you filter it. First, many users overlook the fact that Excel 2003 automatically displays the total of selected cells in the status bar at the bottom of the screen, as shown in Figure 3. If you don't see this total, right-click on the status bar and enable the Sum option. Alternatively you can choose to display another statistic instead: Average, Count, Numerical Count, Minimum, and Maximum.
Figure 3: The status bar generally gives you an instant total for the selected cells.
You can also accomplish this by using the SUBTOTAL function. To do so, enter this formula in cell C23:
The 9 instructs SUBTOTAL that we want to sum. Consult Excel's online help file for the other numeric codes, although I will mention that 1 will give you an average, while 4 gives you the maximum, or largest value. SUBTOTAL is similar to SUM, but has a special capability of only tallying visible rows.
For comparison, enter this formula in cell C24:
Figure 4: The filtered list.
Now, filter the list for Orange T-shirts. As shown in Figure 4, SUBTOTAL should return 25,157, while SUM always returns 99,559, regardless of how the list is filtered. SUM always tallies all rows, regardless of their hidden status. SUBTOTAL has other interesting capabilities, which I'll explore soon in a separate article.
A previous version of this article first appeared on www.accountingweb.com .
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 firstname.lastname@example.org or follow him on Twitter. David speaks at conferences about Microsoft Excel, and presents webcasts for several CPE providers, including AccountingWEB partner CPE Link