Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Performing Calculations while Filtering.

# Performing Calculations while Filtering

by Allen Wyatt
(last updated March 6, 2015)

Filtering a list means displaying only a part of it. You provide the criteria you want used, and then Excel displays only those list records that match the criteria. Filtering is especially useful if you have a large list and you want to work with only a subset of the records in the list. Other ExcelTips have described different ways you can create and apply filters to your worksheets.

When you are using the advanced filtering capabilities of Excel you can perform calculations during the filtering process. For instance, let's assume you have a large inventory list in a worksheet, and you want to filter the list to show only those records that were in a particular department and that have a higher-than-average profit. The inventory is contained in starts at cell A6 (with your column headings) and the profit is listed in column I. (See Figure 1.)

Figure 1. Example inventory data in a worksheet.

You can use an advanced filter by setting up your criteria in other cells. For instance, let's say that your criteria are in the cell range A1:B2. (See Figure 2.)

Figure 2. Example filtering criteria.

Row 1 contains the names of the columns in your datasheet that you want compared in the filtering. Thus, cell A1 contains the name "Item" because you want the value under it (in cell A2) to be used in filtering the data table based on the contents of the Item column. There is no column name in cell B1 because you aren't keying the criteria on a column's contents; you want it based on a calculation. Here are the formulas you should place in cells A2 and B2:

Cell Formula A2 ="W2*" B2 =I7>AVERAGE(\$I\$7:\$I\$42)

This example provides for a text comparison related to the department number (in cell A2) and a comparison of the profit for the item (I7, which is a relative cell reference and therefore changes for each comparison) to the average profit for the entire inventory (\$I\$7:\$I\$42, which is an absolute reference and therefore does not change for each comparison). If an absolute reference had not been used for the AVERAGE function, the wrong results would have been generated by the filtering.

When you apply an advanced filter to your inventory data (as described in other ExcelTips), the result, using the above criteria, is that only those records that had a profit greater than the average (the average in I7:I42) were displayed.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2982) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Performing Calculations while Filtering.

##### Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

##### MORE FROM ALLEN

Selecting Fonts for a Chart

Microsoft Chart uses text to label items in a chart. Here's how to change the font used for that text.

Discover More

Getting Rid of the "Enable Macros" Notice

Do you get tired of the dialog box that says "do you want to enable macros" that is displayed when you open a workbook. You ...

Discover More

Specifying a Collating Sequence for Indexes

The indexing feature provided by Word can be a great help, but in some situations it may not sort your index as you desire. ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

Many people know how to use AutoFilter, but there are times when you need some more filtering muscle. Here's how you can use ...

Discover More

Extracting Targeted Records from a List

When working with large amounts of data, you may have a need to extract just the information that meets the criteria you ...

Discover More

Copying the Results of Filtering

Filtering is a great asset when you need to get a handle on a subset of your data. Excel even makes it easy to copy the ...

Discover More
##### Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. Youâ€™ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 8?

There are currently no comments for this tip. (Be the first to leave your commentâ€”just use the simple form above!)

##### This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.