Excel.Tips.Net Welcome toExcel.Tips.Net

Helpful Links

Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment

Tips.Net Store

ExcelTips FAQ
ExcelTips Premium

Learn Access Now

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

Newest Tips

Assigning a Macro to a Keyboard Combination

Creating Scenarios

Using Message Boxes

Understanding Phantom Macros

Picking a Group of Cells

Running Out of Memory

Hiding Rows Based on a Cell Value

 

Advanced Filtering

Summary: When working with large amounts of data, it is helpful to be able to filter that data so that you only see a subset of the whole. One of the filtering tools available in Excel is referred to as advanced filtering, and it allows you to be very specific on what you want to see in your subset of data. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, and Excel 2003.)

There are some situations in which AutoFilter just doesn't have the muscle you need when processing your data. For instance, you might need to perform a calculation in a filter comparison. In these cases, you can use the advanced filtering capabilities of Excel.

Advanced filtering requires that you set up a criteria range in your worksheet. This criteria range is not part of your data list, but instead is used to signify how you want filtering to be performed. Typically, you would place your criteria before your data list, but you can also place it after. The important thing is that you separate your criteria from you data list by at least one empty row. Otherwise, Excel may think that the criteria are part of the actual data list.

The criteria are entered in your worksheet such that each column represents a different logical AND comparison, and each row represents a different logical OR comparison. If this sounds confusing, don't be concerned. An example will help clear things up.

Let's say you have a data list that starts in the sixth row of a worksheet. You have set aside the rows above this to specify your filtering criteria. The data list contains columns that describe information in your inventory. There are columns for item numbers, description, location, quantity, value, and the like. There is also a calculated column that indicates the profit derived from each inventory item.

At some time you may want to filter your data list so it shows only a limited subset of your inventory items. For instance, you might want to see only those items for which the quantity is over 2500 and profit is less than 1000, or those items where the quantity is greater than 7500, or those items where profit is under 100. (This is much more complex than you can perform using an custom AutoFilter.)

To set up such a filter, all you need to do is set your criteria. In this case, you would use cells A1:B4 as follows:

 A B
1 Quantity Profit
2 >2500 <1000
3 >7500
4  <100

In this example the first row shows the field names to be used in comparisons, while the second through fourth rows define the actual comparisons. Notice that because there are two tests in the second row, these are considered an AND condition, and those on the other rows are considered OR conditions.

To apply these filtering criteria, follow these steps:

  1. Select any cell in the data list (not in the criteria).
  2. Choose the Filter option from the Data menu. Excel displays a submenu.
  3. Choose the Advanced Filter option from the submenu. Excel displays the Advanced Filter dialog box. (Click here to see a related figure.) The List Range should automatically be set to your data list.
  4. Select the Criteria Range field. The insertion point should appear within the field.
  5. Use the mouse to select the criteria range, cells A1:B4.
  6. Click on OK.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2858) applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003

Don't Go in Debt for Christmas! Tired of trying to keep up with the Joneses for Christmas? Want to enjoy the season rather than dread the aftermath? Learn how you can avoid the financial traps that spring up every Christmas.
 
Check out Top Fifteen Tips for Financing Christmas today!