Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Advanced Filtering.
Written by Allen Wyatt (last updated July 13, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021
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 a 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:
Figure 1. The Advanced Filter dialog box. (The List Range will be filled in if you do step 1.)
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7851) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Advanced Filtering.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
Given a long list of names, part numbers, or what-have-you, you may need to determine the unique values within the list. ...
Discover MoreIf you have a bunch of data in an Excel worksheet, you may need to work with just a subset of that data. One way to do ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments