Excel Filtering Tips: Autofilter by Example
Excel Filtering Tips: Autofilter by Example
Autofilter by Example
While youre viewing a large Excel list, you can scroll to a row that contains data of interest and then quickly filter the list to display all rows that have values matching the value in the selected cell. To do this, you must first add the special Autofilter button to a toolbar. How to: 1. Choose View, Toolbars, Customize to open the Customize dialog. 2. Click the Commands tab to bring it to the fore. 3. Scroll down the list of Categories (at left) and select Data. 4. Then scroll down the list of Commands (at right) and select Autofilter. 5. Drag this command to any existing toolbar (your Standard toolbar for example) and drop it to add a button to the toolbar that looks like the one in the illustration at right. Now: You need not have the Autofilter turned on to use the Autofilter button. Select any cell in the list that has a value of interest. Click the Autofilter button you just added to a toolbar. Excel automatically turns on the Autofilter and filters using the value in the selected cell. If you want to apply multiple filters to the list, continue in the same way. That is, select a cell in the now-filtered list that contains a value you want to use to filter the list further. Then click the Autofilter button. Excel restricts the data view by that additional criteria. When youre finished, toggle off the Autofilter in the usual way (Data, Filter, Autofilter).
Advanced Filter
Remember that the Advanced Filter allows you more flexibility in setting criteria than does the Autofilter. You can use the Advanced Filter to apply multiple criteria to a single column (more than the 2 allowed by the Autofilters Custom option), apply multiple criteria to multiple columns, or create criteria that result from a formula. Examples of advanced filter criteria Multiple conditions in a single field (column) If you have two or more conditions you want to use to filter a single field in the data, type the criteria directly below each other in separate rows. For example, the following criteria range displays the rows that contain "Albany or
Baltimore or Boston or Charlotte in the Market column. Market Albany Baltimore Boston Charlotte
One condition in two or more fields To find data that satisfies criteria in two or more record fields, enter all the criteria in the same row of the criteria range. For example, the following criteria range displays all rows that contain Charlotte in the Market column, Dole in the Brand column, and 46 in the Size column. Market Charlotte Brand Dole Size 46
Note that you can also use the Autofilter in this case. You can specify multiple conditions for different columns and display only the rows that meet all the conditions using the AutoFilter. One condition in one field or another To find data that meets either a condition in one field or a condition in another field, enter the criteria in different rows of the criteria range. For example, the following criteria range displays all rows that contain "Charlotte" in the Market column or "Dole" in the Brand column or values greater than 33 in the Size column. Market Charlotte Brand Dole >33 One of two sets of conditions for two fields To find rows that meet one of two or more sets of conditions, where each set includes conditions for more than one field, type the criteria in separate rows. For example, the following criteria range displays the rows that contain "Charlotte" for Market and JCYJC for Brand and 46 for Size. It also displays rows where Baltimore is Market and Dole is Brand and 33 is Size. And it Size
also displays rows where Raleigh is Market, any value is Brand, and Size is greater than 33. Market Charlotte Baltimore Raleigh Brand JCYJC Dole Size 46 33 >33
Conditions created as the result of a formula You can use a calculated value thats the result of a formula as a criterion. When you use a formula to create a criterion, you must not use a column label from the list as the criteria label; either keep the criterion label blank or use a label thats not a column label from the list. Your formula in the criterion range will evaluate to TRUE or FALSE. Other tips: - If your criterion formula references a field in the list, write the formula in the criterion to use a relative reference to that value in the first row of the list. - If your criterion formula uses values in the list to derive some other value thats not in the list (for example, gets the average of Sales Rate values in the list), you must use absolute references in the average calculation to refer to the Sales Rate values. Special Note: If you neglect to use an absolute reference in this case, Excel 2000 will return values (unlike Excel 97, which gave an error) and you may think your filter has worked. However, chances are that not all valid values will be returned. - If your criterion formula refers to a value outside the list, use an absolute reference to that value. For example, the criteria range below finds records that have Charlotte as Market, JCYJC as Brand, and whose Sales Rate is greater than the average Sales Rate for all records in the list. Market Charlotte Brand JCYJC Calc TRUE
The part of the formula that calculates the average references all the values in the Sales Rate column using an absolute reference. E.g., =average($K$8:$K$1096).