Filter data in a range or table in Excel

Applies To

Use AutoFilter or built-in comparison operators like “greater than” and “top 10” in Excel to show the data you want and hide the rest. Once you filter data in a range of cells or table, you can either reapply a filter to get up-to-date results, or clear a filter to redisplay all of the data.WindowsWebmacOS

Use filters to temporarily hide some of the data in a table, so you can focus on the data you want to see.

Filter a range of data

  1. Select any cell within the range.
  2. Select Data Filter.
  3. Select the column header arrow Filter arrow.
  4. Select Text Filters or Number Filters, and then select a comparison, like Between.Number Filters Between
  5. Enter the filter criteria and select OK.Custom AutoFilter dialog box

Filter data in a table

When you put your data in a table, filter controls are automatically added to the table headers.An Excel table showing built-in filters

  1. Select the column header arrow Filter drop-down arrow for the column you want to filter.
  2. Uncheck (Select All) and select the boxes you want to show.Filter Gallery
  3. Select OK.The column header arrow Filter drop-down arrow changes to a Applied filter iconFilter icon. Select this icon to change or clear the filter.

Filter by font color, cell color, or icon sets

Applies To

Important: Some of the content in this topic may not be applicable to some languages.

You can quickly filter data based on visual criteria, such as font color, cell color, or icon sets. And you can filter whether you have formatted cells, applied cell styles, or used conditional formatting.

  1. In a range of cells or a table column, click a cell that contains the cell color, font color, or icon that you want to filter by.
  2. On the Data tab, click Filter.On the Data tab, select Filter
  3. Click the arrow AutoFilter arrow in the column that contains the content that you want to filter.
  4. Under Filter, in the By color pop-up menu, select Cell ColorFont Color, or Cell Icon, and then click the criteria.Example of filtering by cell color

Filter by using advanced criteria

Applies To

If the data you want to filter requires complex criteria (such as Type = “Produce” OR Salesperson = “Davolio”), you can use the Advanced Filter dialog box.

To open the Advanced Filter dialog box, click Data > Advanced.

The Sort & Filter group on the Data tab
Advanced FilterExample
Overview of advanced filter criteria
Multiple criteria, one column, any criteria trueSalesperson = “Davolio” OR Salesperson = “Buchanan”
Multiple criteria, multiple columns, all criteria trueType = “Produce” AND Sales > 1000
Multiple criteria, multiple columns, any criteria trueType = “Produce” OR Salesperson = “Buchanan”
Multiple sets of criteria, one column in all sets(Sales > 6000 AND Sales < 6500 ) OR (Sales < 500)
Multiple sets of criteria, multiple columns in each set(Salesperson = “Davolio” AND Sales >3000) OR
(Salesperson = “Buchanan” AND Sales > 1500)
Wildcard criteriaSalesperson = a name with ‘u’ as the second letter

Overview of advanced filter criteria

The Advanced command works differently from the Filter command in several important ways.

  • It displays the Advanced Filter dialog box instead of the AutoFilter menu.
  • You type the advanced criteria in a separate criteria range on the worksheet and above the range of cells or table that you want to filter. Microsoft Office Excel uses the separate criteria range in the Advanced Filter dialog box as the source for the advanced criteria.

Sample data

The following sample data is used for all procedures in this article.

The data includes four blank rows above the list range that will be used as a criteria range (A1:C4) and a list range (A6:C10). The criteria range has column labels and includes at least one blank row between the criteria values and the list range.

To work with this data, select it in the following table, copy it, and then paste it in cell A1 of a new Excel worksheet.

TypeSalespersonSales
TypeSalespersonSales
BeveragesSuyama$5122
MeatDavolio$450
produceBuchanan$6328
ProduceDavolio$6544

Comparison operators

You can compare two values by using the following operators. When two values are compared by using these operators, the result is a logical value—either TRUE or FALSE.

Comparison operatorMeaningExample
= (equal sign)Equal toA1=B1
> (greater than sign)Greater thanA1>B1
< (less than sign)Less thanA1<B1
>= (greater than or equal to sign)Greater than or equal toA1>=B1
<= (less than or equal to sign)Less than or equal toA1<=B1
<> (not equal to sign)Not equal toA1<>B1

Using the equal sign to type text or a value

Because the equal sign (=) is used to indicate a formula when you type text or a value in a cell, Excel evaluates what you type; however, this may cause unexpected filter results. To indicate an equality comparison operator for either text or a value, type the criteria as a string expression in the appropriate cell in the criteria range:

=”= entry 

Where entry is the text or value you want to find. For example:

What you type in the cellWhat Excel evaluates and displays
=”=Davolio”=Davolio
=”=3000″=3000

Considering case-sensitivity

When filtering text data, Excel doesn’t distinguish between uppercase and lowercase characters. However, you can use a formula to perform a case-sensitive search. For an example, see the section Wildcard criteria.

Using pre-defined names

You can name a range Criteria, and the reference for the range will appear automatically in the Criteria range box. You can also define the name Database for the list range to be filtered and define the name Extract for the area where you want to paste the rows, and these ranges will appear automatically in the List range and Copy to boxes, respectively.

Creating criteria by using a formula

You can use a calculated value that is the result of a formula as your criterion. Remember the following important points:

  • The formula must evaluate to TRUE or FALSE.
  • Because you are using a formula, enter the formula as you normally would, and do not type the expression in the following way:=”= entry 
  • Do not use a column label for criteria labels; either keep the criteria labels blank or use a label that is not a column label in the list range (in the examples that follow, Calculated Average and Exact Match).If you use a column label in the formula instead of a relative cell reference or a range name, Excel displays an error value such as #NAME? or #VALUE! in the cell that contains the criterion. You can ignore this error because it does not affect how the list range is filtered.
  • The formula that you use for criteria must use a relative reference to refer to the corresponding cell in the first row of data.
  • All other references in the formula must be absolute references.

Multiple criteria, one column, any criteria true

Boolean logic:    (Salesperson = “Davolio” OR Salesperson = “Buchanan”)

  1. Insert at least three blank rows above the list range that can be used as a criteria range. The criteria range must have column labels. Make sure that there is at least one blank row between the criteria values and the list range.
  2. To find rows that meet multiple criteria for one column, type the criteria directly below each other in separate rows of the criteria range. Using the example, enter:TypeSalespersonSales=”=Davolio”=”=Buchanan”
  3. Click a cell in the list range. Using the example, click any cell in the range A6:C10.
  4. On the Data tab, in the Sort & Filter group, click Advanced.The Sort & Filter group on the Data tab
  5. Do one of the following:
    • To filter the list range by hiding rows that don’t match your criteria, click Filter the list, in-place.
    • To filter the list range by copying rows that match your criteria to another area of the worksheet, click Copy to another location, click in the Copy to box, and then click the upper-left corner of the area where you want to paste the rows.Tip    When you copy filtered rows to another location, you can specify which columns to include in the copy operation. Before filtering, copy the column labels for the columns that you want to the first row of the area where you plan to paste the filtered rows. When you filter, enter a reference to the copied column labels in the Copy to box. The copied rows will then include only the columns for which you copied the labels.
  6. In the Criteria range box, enter the reference for the criteria range, including the criteria labels. Using the example, enter $A$1:$C$3.To move the Advanced Filter dialog box out of the way temporarily while you select the criteria range, click Collapse Dialog Button image.

Using the example, the filtered result for the list range is:

TypeSalespersonSales
MeatDavolio$450
produceBuchanan$6,328
ProduceDavolio$6,544

Multiple criteria, multiple columns, all criteria true

Boolean logic:    (Type = “Produce” AND Sales > 1000)

  1. Insert at least three blank rows above the list range that can be used as a criteria range. The criteria range must have column labels. Make sure that there is at least one blank row between the criteria values and the list range.
  2. To find rows that meet multiple criteria in multiple columns, type all the criteria in the same row of the criteria range. Using the example, enter:TypeSalespersonSales=”=Produce”>1000
  3. Click a cell in the list range. Using the example, click any cell in the range A6:C10.
  4. On the Data tab, in the Sort & Filter group, click Advanced.The Sort & Filter group on the Data tab
  5. Do one of the following:
    • To filter the list range by hiding rows that don’t match your criteria, click Filter the list, in-place.
    • To filter the list range by copying rows that match your criteria to another area of the worksheet, click Copy to another location, click in the Copy to box, and then click the upper-left corner of the area where you want to paste the rows.Tip    When you copy filtered rows to another location, you can specify which columns to include in the copy operation. Before filtering, copy the column labels for the columns that you want to the first row of the area where you plan to paste the filtered rows. When you filter, enter a reference to the copied column labels in the Copy to box. The copied rows will then include only the columns for which you copied the labels.
  6. In the Criteria range box, enter the reference for the criteria range, including the criteria labels. Using the example, enter $A$1:$C$2.To move the Advanced Filter dialog box out of the way temporarily while you select the criteria range, click Collapse Dialog Button image.

Using the example, the filtered result for the list range is:

TypeSalespersonSales
produceBuchanan$6,328
ProduceDavolio$6,544

Multiple sets of criteria, one column in all sets

Boolean logic:     ( (Sales > 6000 AND Sales < 6500 ) OR (Sales < 500) )

  1. Insert at least three blank rows above the list range that can be used as a criteria range. The criteria range must have column labels. Make sure that there is at least one blank row between the criteria values and the list range.
  2. To find rows that meet multiple sets of criteria where each set includes criteria for one column, include multiple columns with the same column heading. Using the example, enter:
TypeSalespersonSalesSales
>6000<6500
<500
  1. Click a cell in the list range. Using the example, click any cell in the list range A6:C10.
  2. On the Data tab, in the Sort & Filter group, click Advanced.The Sort & Filter group on the Data tab
  3. Do one of the following:
    • To filter the list range by hiding rows that don’t match your criteria, click Filter the list, in-place.
    • To filter the list range by copying rows that match your criteria to another area of the worksheet, click Copy to another location, click in the Copy to box, and then click the upper-left corner of the area where you want to paste the rows.Tip: When you copy filtered rows to another location, you can specify which columns to include in the copy operation. Before filtering, copy the column labels for the columns that you want to the first row of the area where you plan to paste the filtered rows. When you filter, enter a reference to the copied column labels in the Copy to box. The copied rows will then include only the columns for which you copied the labels.
  4. In the Criteria range box, enter the reference for the criteria range, including the criteria labels. Using the example, enter $A$1:$D$3.To move the Advanced Filter dialog box out of the way temporarily while you select the criteria range, click Collapse Dialog Button image.
  5. Using the example, the filtered result for the list range is:
TypeSalespersonSales
MeatDavolio$450
produceBuchanan$6,328

Multiple sets of criteria, multiple columns in each set

Boolean logic:    ( (Salesperson = “Davolio” AND Sales >3000) OR (Salesperson = “Buchanan” AND Sales > 1500) )

  1. Insert at least three blank rows above the list range that can be used as a criteria range. The criteria range must have column labels. Make sure that there is at least one blank row between the criteria values and the list range.
  2. To find rows that meet multiple sets of criteria, where each set includes criteria for multiple columns, type each set of criteria in separate columns and rows. Using the example, enter:
TypeSalespersonSales
=”=Davolio”>3000
=”=Buchanan”>1500
  1. Click a cell in the list range. Using the example, click any cell in the list range A6:C10.
  2. On the Data tab, in the Sort & Filter group, click Advanced.The Sort & Filter group on the Data tab
  3. Do one of the following:
    • To filter the list range by hiding rows that don’t match your criteria, click Filter the list, in-place.
    • To filter the list range by copying rows that match your criteria to another area of the worksheet, click Copy to another location, click in the Copy to box, and then click the upper-left corner of the area where you want to paste the rows.Tip    When you copy filtered rows to another location, you can specify which columns to include in the copy operation. Before filtering, copy the column labels for the columns that you want to the first row of the area where you plan to paste the filtered rows. When you filter, enter a reference to the copied column labels in the Copy to box. The copied rows will then include only the columns for which you copied the labels.
  4. In the Criteria range box, enter the reference for the criteria range, including the criteria labels. Using the example, enter $A$1:$C$3.To move the Advanced Filter dialog box out of the way temporarily while you select the criteria range, click Collapse Dialog Button image.
  5. Using the example, the filtered result for the list range would be:
TypeSalespersonSales
produceBuchanan$6,328
ProduceDavolio$6,544

Wildcard criteria

Boolean logic:    Salesperson = a name with ‘u’ as the second letter

  1. To find text values that share some characters but not others, do one or more of the following:
    • Type one or more characters without an equal sign (=) to find rows with a text value in a column that begin with those characters. For example, if you type the text Dav as a criterion, Excel finds “Davolio,” “David,” and “Davis.”
    • Use a wildcard character.
UseTo find
? (question mark)Any single character
For example, sm?th finds “smith” and “smyth”
* (asterisk)Any number of characters
For example, *east finds “Northeast” and “Southeast”
~ (tilde) followed by ?, *, or ~A question mark, asterisk, or tilde
For example, fy91~? finds “fy91?”
  1. Insert at least three blank rows above the list range that can be used as a criteria range. The criteria range must have column labels. Make sure that there is at least one blank row between the criteria values and the list range.
  2. In the rows below the column labels, type the criteria that you want to match. Using the example, enter:
TypeSalespersonSales
=”=Me*”
=”=?u*”
  1. Click a cell in the list range. Using the example, click any cell in the list range A6:C10.
  2. On the Data tab, in the Sort & Filter group, click Advanced.The Sort & Filter group on the Data tab
  3. Do one of the following:
    • To filter the list range by hiding rows that don’t match your criteria, click Filter the list, in-place
    • To filter the list range by copying rows that match your criteria to another area of the worksheet, click Copy to another location, click in the Copy to box, and then click the upper-left corner of the area where you want to paste the rows.Tip: When you copy filtered rows to another location, you can specify which columns to include in the copy operation. Before filtering, copy the column labels for the columns that you want to the first row of the area where you plan to paste the filtered rows. When you filter, enter a reference to the copied column labels in the Copy to box. The copied rows will then include only the columns for which you copied the labels.
  4. In the Criteria range box, enter the reference for the criteria range, including the criteria labels. Using the example, enter $A$1:$B$3.To move the Advanced Filter dialog box out of the way temporarily while you select the criteria range, click Collapse Dialog Button image.
  5. Using the example, the filtered result for the list range is:
TypeSalespersonSales
BeveragesSuyama$5,122
MeatDavolio$450
produceBuchanan$6,328