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.
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
-
Select any cell within the range.
-
Select Data > Filter.
-
Select the column header arrow .
-
Select Text Filters or Number Filters, and then select a comparison, like Between.
-
Enter the filter criteria and select OK.
Filter data in a table
When you put your data in a table, filter controls are automatically added to the table headers.
-
Select the column header arrow for the column you want to filter.
-
Uncheck (Select All) and select the boxes you want to show.
-
Click OK.
The column header arrow changes to a Filter icon. Select this icon to change or clear the filter.
Related Topics
Excel Training: Filter data in a table
Guidelines and examples for sorting and filtering data by color
Filter data in a PivotTable
Filter by using advanced criteria
Remove a filter
Filtered data displays only the rows that meet criteria that you specify and hides rows that you do not want displayed. After you filter data, you can copy, find, edit, format, chart, and print the subset of filtered data without rearranging or moving it.
You can also filter by more than one column. Filters are additive, which means that each additional filter is based on the current filter and further reduces the subset of data.
Note: When you use the Find dialog box to search filtered data, only the data that is displayed is searched; data that is not displayed is not searched. To search all the data, clear all filters.
The two types of filters
Using AutoFilter, you can create two types of filters: by a list value or by criteria. Each of these filter types is mutually exclusive for each range of cells or column table. For example, you can filter by a list of numbers, or a criteria, but not by both; you can filter by icon or by a custom filter, but not by both.
Reapplying a filter
To determine if a filter is applied, note the icon in the column heading:
-
A drop-down arrow means that filtering is enabled but not applied.
When you hover over the heading of a column with filtering enabled but not applied, a screen tip displays «(Showing All)».
-
A Filter button means that a filter is applied.
When you hover over the heading of a filtered column, a screen tip displays the filter applied to that column, such as «Equals a red cell color» or «Larger than 150».
When you reapply a filter, different results appear for the following reasons:
-
Data has been added, modified, or deleted to the range of cells or table column.
-
Values returned by a formula have changed and the worksheet has been recalculated.
Do not mix data types
For best results, do not mix data types, such as text and number, or number and date in the same column, because only one type of filter command is available for each column. If there is a mix of data types, the command that is displayed is the data type that occurs the most. For example, if the column contains three values stored as number and four as text, the Text Filters command is displayed .
Filter data in a table
When you put your data in a table, filtering controls are added to the table headers automatically.
-
Select the data you want to filter. On the Home tab, click Format as Table, and then pick Format as Table.
-
In the Create Table dialog box, you can choose whether your table has headers.
-
Select My table has headers to turn the top row of your data into table headers. The data in this row won’t be filtered.
-
Don’t select the check box if you want Excel for the web to add placeholder headers (that you can rename) above your table data.
-
-
Click OK.
-
To apply a filter, click the arrow in the column header, and pick a filter option.
Filter a range of data
If you don’t want to format your data as a table, you can also apply filters to a range of data.
-
Select the data you want to filter. For best results, the columns should have headings.
-
On the Data tab, choose Filter.
Filtering options for tables or ranges
You can either apply a general Filter option or a custom filter specific to the data type. For example, when filtering numbers, you’ll see Number Filters, for dates you’ll see Date Filters, and for text you’ll see Text Filters. The general filter option lets you select the data you want to see from a list of existing data like this:
Number Filters lets you apply a custom filter:
In this example, if you want to see the regions that had sales below $6,000 in March, you can apply a custom filter:
Here’s how:
-
Click the filter arrow next to March > Number Filters > Less Than and enter 6000.
-
Click OK.
Excel for the web applies the filter and shows only the regions with sales below $6000.
You can apply custom Date Filters and Text Filters in a similar manner.
To clear a filter from a column
-
Click the Filter button next to the column heading, and then click Clear Filter from <«Column Name»>.
To remove all the filters from a table or range
-
Select any cell inside your table or range and, on the Data tab, click the Filter button.
This will remove the filters from all the columns in your table or range and show all your data.
-
Click a cell in the range or table that you want to filter.
-
On the Data tab, click Filter.
-
Click the arrow in the column that contains the content that you want to filter.
-
Under Filter, click Choose One, and then enter your filter criteria.
Notes:
-
You can apply filters to only one range of cells on a sheet at a time.
-
When you apply a filter to a column, the only filters available for other columns are the values visible in the currently filtered range.
-
Only the first 10,000 unique entries in a list appear in the filter window.
-
Click a cell in the range or table that you want to filter.
-
On the Data tab, click Filter.
-
Click the arrow in the column that contains the content that you want to filter.
-
Under Filter, click Choose One, and then enter your filter criteria.
-
In the box next to the pop-up menu, enter the number that you want to use.
-
Depending on your choice, you may be offered additional criteria to select:
Notes:
-
You can apply filters to only one range of cells on a sheet at a time.
-
When you apply a filter to a column, the only filters available for other columns are the values visible in the currently filtered range.
-
Only the first 10,000 unique entries in a list appear in the filter window.
-
Instead of filtering, you can use conditional formatting to make the top or bottom numbers stand out clearly in your data.
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.
-
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.
-
On the Data tab, click Filter .
-
Click the arrow in the column that contains the content that you want to filter.
-
Under Filter, in the By color pop-up menu, select Cell Color, Font Color, or Cell Icon, and then click a color.
This option is available only if the column that you want to filter contains a blank cell.
-
Click a cell in the range or table that you want to filter.
-
On the Data toolbar, click Filter.
-
Click the arrow in the column that contains the content that you want to filter.
-
In the (Select All) area, scroll down and select the (Blanks) check box.
Notes:
-
You can apply filters to only one range of cells on a sheet at a time.
-
When you apply a filter to a column, the only filters available for other columns are the values visible in the currently filtered range.
-
Only the first 10,000 unique entries in a list appear in the filter window.
-
-
Click a cell in the range or table that you want to filter.
-
On the Data tab, click Filter .
-
Click the arrow in the column that contains the content that you want to filter.
-
Under Filter, click Choose One, and then in the pop-up menu, do one of the following:
To filter the range for
Click
Rows that contain specific text
Contains or Equals.
Rows that do not contain specific text
Does Not Contain or Does Not Equal.
-
In the box next to the pop-up menu, enter the text that you want to use.
-
Depending on your choice, you may be offered additional criteria to select:
To
Click
Filter the table column or selection so that both criteria must be true
And.
Filter the table column or selection so that either or both criteria can be true
Or.
-
Click a cell in the range or table that you want to filter.
-
On the Data toolbar, click Filter .
-
Click the arrow in the column that contains the content that you want to filter.
-
Under Filter, click Choose One, and then in the pop-up menu, do one of the following:
To filter for
Click
The beginning of a line of text
Begins With.
The end of a line of text
Ends With.
Cells that contain text but do not begin with letters
Does Not Begin With.
Cells that contain text but do not end with letters
Does Not End With.
-
In the box next to the pop-up menu, enter the text that you want to use.
-
Depending on your choice, you may be offered additional criteria to select:
To
Click
Filter the table column or selection so that both criteria must be true
And.
Filter the table column or selection so that either or both criteria can be true
Or.
Wildcard characters can be used to help you build criteria.
-
Click a cell in the range or table that you want to filter.
-
On the Data toolbar, click Filter.
-
Click the arrow in the column that contains the content that you want to filter.
-
Under Filter, click Choose One, and select any option.
-
In the text box, type your criteria and include a wildcard character.
For example, if you wanted your filter to catch both the word «seat» and «seam», type sea?.
-
Do one of the following:
Use
To 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)
A question mark or an asterisk
For example, there~? finds «there?»
Do any of the following:
To |
Do this |
---|---|
Remove specific filter criteria for a filter |
Click the arrow in a column that includes a filter, and then click Clear Filter. |
Remove all filters that are applied to a range or table |
Select the columns of the range or table that have filters applied, and then on the Data tab, click Filter. |
Remove filter arrows from or reapply filter arrows to a range or table |
Select the columns of the range or table that have filters applied, and then on the Data tab, click Filter. |
When you filter data, only the data that meets your criteria appears. The data that doesn’t meet that criteria is hidden. After you filter data, you can copy, find, edit, format, chart, and print the subset of filtered data.
Table with Top 4 Items filter applied
Filters are additive. This means that each additional filter is based on the current filter and further reduces the subset of data. You can make complex filters by filtering on more than one value, more than one format, or more than one criteria. For example, you can filter on all numbers greater than 5 that are also below average. But some filters (top and bottom ten, above and below average) are based on the original range of cells. For example, when you filter the top ten values, you’ll see the top ten values of the whole list, not the top ten values of the subset of the last filter.
In Excel, you can create three kinds of filters: by values, by a format, or by criteria. But each of these filter types is mutually exclusive. For example, you can filter by cell color or by a list of numbers, but not by both. You can filter by icon or by a custom filter, but not by both.
Filters hide extraneous data. In this manner, you can concentrate on just what you want to see. In contrast, when you sort data, the data is rearranged into some order. For more information about sorting, see Sort a list of data.
When you filter, consider the following guidelines:
-
Only the first 10,000 unique entries in a list appear in the filter window.
-
You can filter by more than one column. When you apply a filter to a column, the only filters available for other columns are the values visible in the currently filtered range.
-
You can apply filters to only one range of cells on a sheet at a time.
Note: When you use Find to search filtered data, only the data that is displayed is searched; data that is not displayed is not searched. To search all the data, clear all filters.
Need more help?
You can always ask an expert in the Excel Tech Community or get support in the Answers community.
The FILTER function «filters» a range of data based on supplied criteria. The result is an array of matching values from the original range. In plain language, the FILTER function will extract matching records from a set of data by applying one or more logical tests. Logical tests are supplied as the include argument and can include many kinds of formula criteria. For example, FILTER can match data in a certain year or month, data that contains specific text, or values greater than a certain threshold.
The FILTER function takes three arguments: array, include, and if_empty. Array is the range or array to filter. The include argument should consist of one or more logical tests. These tests should return TRUE or FALSE based on the evaluation of values from array. The last argument, if_empty, is the result to return when FILTER finds no matching values. Typically this is a message like «No records found», but other values can be returned as well. Supply an empty string («») to display nothing.
The results from FILTER are dynamic. When values in the source data change, or the source data array is resized, the results from FILTER will update automatically. Results from FILTER will «spill» onto the worksheet into multiple cells.
Basic example
To extract values in A1:A10 that are greater than 100:
=FILTER(A1:A10,A1:A10>100)
To extract rows in A1:C5 where the value in A1:A5 is greater than 100:
=FILTER(A1:C5,A1:A5>100)
Notice the only difference in the above formulas is that the second formula provides a multi-column range for array. The logical test used for the include argument is the same.
Note: FILTER will return a #CALC! error if no matching data is found
Filter for Red group
In the example shown above, the formula in F5 is:
=FILTER(B5:D14,D5:D14=H2,"No results")
Since the value in H2 is «red», the FILTER function extracts data from array where the Group column contains «red». All matching records are returned to the worksheet starting from cell F5, where the formula exists.
Values can be hardcoded as well. The formula below has the same result as above with «red» hardcoded into the criteria:
=FILTER(B5:D14,D5:D14="red","No results")
No matching data
The value for is_empty is returned when FILTER does not find matching results. If a value for if_empty is not provided, FILTER will return a #CALC! error if no matching data is found:
=FILTER(range,logic) // #CALC! error
Often, is_empty is configured to provide a text message to the user:
=FILTER(range,logic,"No results") // display message
To display nothing when no matching data is found, supply an empty string («») for if_empty:
=FILTER(range,logic,"") // display nothing
Values that contain text
To extract data based on a logical test for values that contain specific text, you can use a formula like this:
=FILTER(rng1,ISNUMBER(SEARCH("txt",rng2)))
In this formula, the SEARCH function is used to look for «txt» in rng2, which would typically be a column in rng1. The ISNUMBER function is used to convert the result from SEARCH into TRUE or FALSE. Read a full explanation here.
Filter by date
FILTER can be used with dates by constructing logical tests appropriate for Excel dates. For example, to extract records from rng1 where the date in rng2 is in July you can use a generic formula like this:
=FILTER(rng1,MONTH(rng2)=7,"No data")
This formula relies on the MONTH function to compare the month of dates in rng2 to 7. See full explanation here.
Multiple criteria
At first glance, it’s not obvious how to apply multiple criteria with the FILTER function. Unlike older functions like COUNTIFS and SUMIFS, which provide multiple arguments for entering multiple conditions, the FILTER function only provides a single argument, include, to target data. The trick is to create logical expressions that use Boolean algebra to target the data of interest and supply these expressions as the include argument. For example, to extract only data where one value is «A» and another is greater than 80, you can use a formula like this:
=FILTER(range,(range="A")*(range>80),"No data")
The math operation of addition (*) joins the two conditions with AND logic: both conditions must be TRUE in order for FILTER to retrieve the data. See a detailed explanation here.
Complex criteria
To filter and extract data based on multiple complex criteria, you can use the FILTER function with a chain of expressions that use boolean logic. For example, the generic formula below filters based on three separate conditions: account begins with «x» AND region is «east», and month is NOT April.
=FILTER(data,(LEFT(account)="x")*(region="east")*NOT(MONTH(date)=4))
See this page for a full explanation. Building criteria with logical expressions is an elegant and flexible approach that can be extended to handle many complex scenarios. See below for more examples.
Notes
- FILTER can work with both vertical and horizontal arrays.
- The include argument must have dimensions compatible with the array argument, otherwise FILTER will return #VALUE!
- If the include array includes any errors, FILTER will return an error.
The FILTER function in Excel is a very useful and frequently used function, that you will likely find the need for in many situations. Note that the FILTER function is only available in Microsoft Office 365, and Microsoft Office Online.
To filter by using the FILTER function in Excel, follow these steps:
- Type =FILTER( to begin your filter formula
- Type the address for the range of cells that contains the data that you want to filter, such as B1:C50
- Type a comma, and then type the condition for the filter, such as C3:C50>3 (To set a condition, first type the address of the «criteria column» such as B1:B, then type an operator symbol such as greater than (>), and then type the criteria, such as the number 3.
- Type a closing parenthesis and then press enter on the keyboard. Your entire formula will look like this: =FILTER(B1:C50,C1:C50>3)
In this article I will start with the basics of using the FILTER function (examples included), and then also show you some more involved ways of using the FILTER function. This article focuses specifically on the FILTER function that is typed into the spreadsheet cells as a formula, and not the filter command available from the toolbar and pop-up menus.
Using the FILTER function in Excel is almost the same as using it in Google Sheets, but there are slight differences between the two. Click here to read the Google Sheets version of this article
Here are the Excel Filters formulas:
Filter by a number
- =FILTER(A3:B12, B3:B12>0.7)
Filter by a cell value
- =FILTER(A3:B12, B3:B12<F1)
Filter by a text string
- =FILTER(A3:B12, B3:B12=»Late»)
Filter where NOT equal to
- =FILTER(A3:E1000, B3:B1000<>»Bob»)
Filter by date
- =FILTER(A3:C12,C3:C12<G1) (Date entered in cell G1)
- =FILTER(A3:C12,C3:C12<DATE(2019,6,1))
Filter by multiple conditions
- =FILTER(A3:C12,(B3:B12=»Late»)*(C3:C12=»Active»)) (AND logic)
- =FILTER(A3:C12, (B3:B12=»Late»)+(C3:C12=»Active»)) (OR logic)
Filter from another sheet
- =FILTER(‘Sheet Name’!A3:B12,’Sheet Name’!B3:B12=»Full Time»)
=FILTER(A3:B12, B3:B12=F1)
(Copy/Paste the formula above into your sheet and modify as needed)
The FILTER function in Excel allows you to filter a range of data by a specified condition, so that a new set of data will be displayed which only shows the rows/columns from the original data set that meets the criteria/condition set in the formula.
Excel description for FILTER function:
Syntax:
=FILTER(array,include,[if_empty])Formula summary: “The FILTER function filters an array based on a Boolean (True/False) array.”
array (Required): The array, or range to filter
include (Required): A Boolean array whose height or width is the same as the array
[if_empty] (Optional): The value to return if all values in the included array are empty (filter returns nothing)
The source range that you want to filter, can be a single column or multiple columns.
The range that is used to check against the criteria that you set, must be a single column (later I will show you how to filter by multiple conditions, but don’t worry about that for now).
The criteria that set in the condition can be manually typed into the formula as a number or text, or it can also be a cell reference.
*Note that the source range and the single column range for the condition, must be the same size (must contain the same number of rows), or the cell will display an error.
Filtering by a single condition in Excel
First let’s go over using the FILTER function in Excel in its simplest form, with a single condition/criteria.
I will show you how to filter by a number, a cell value, a text string, a date… and I will also show you how to use varying «operators» (Less than, Equal to, etc…) in the filter condition.
Part 1: How to filter by a number
In this first example on how to use the filter function in Excel, the scenario is that we have a list of students and their grades, and that we want to make a filtered list of only students who have a perfect grade.
The task: Show a list of students and their scores, but only those that have a perfect grade
The logic: Filter the range A3:B12, where the column B3:B12 is greater than 0.7 (70%)
The formula: The formula below, is entered in the blue cell (D3), for this example
=FILTER(A3:B12, B3:B12>0.7)
Operators that can be used in the FILTER function:
In this example we are using the operator «=» (Equal To) for the filter condition/criteria, but you can also use any of the following:
«=» (Equals)
«>» (Greater than)
«<» (Less than)
«<>» (Not equal to)
«>=» (Greater than or equal to)
«<=» (Less than or equal to)
Part 2: How to filter by a cell value in Excel
In this example, we want to achieve the same goal as discussed above, but rather than typing the condition that we want to filter by directly into the formula, we are using a cell reference.
When you filter by a cell value in Excel, your sheet will be setup so that you can change the value in the cell at any time, which will automatically update the value that the filter criteria it attached to.
In this example, you will notice that instead of directly typing the number “0.9” into the formula itself, the filter criteria is set as cell G1, where the “0.9” value is entered.
The task: Show a list of students and their scores, but only those that have a score below 90%
The logic: Filter the range A3:B12, where B3:B12 is less than the value that is entered in the cell F1 (0.9)
The formula: The formula below, is entered in the blue cell (D3), for this example
=FILTER(A3:B12, B3:B12<F1)
Part 3: How to filter by text in Excel
In this example, we are going to use a text string as the criteria for the filter formula. This is very similar to using a number, except that you must put the text that you want to filter by inside of quotation marks.
In this scenario we are filtering a list that shows customers and their payment status, and we want to display only customers that have a payment status of “Late”.
The task: Show a list of customers who are past due on their payments
The logic: Filter the range A3:B12, where B3:B12 equals the text, “Late”
The formula: The formula below, is entered in the blue cell (D3), for this example
=FILTER(A3:B12, B3:B12=»Late»)
Part 4: Using NOT EQUAL TO in the Excel FILTER function
Now that you have got a basic understanding of how to use the filter function in Excel, here is another example of filtering by a string of text, but in this example we will use the «not equal» operator (<>), so that you can learn how to filter a range and output data that is NOT equal to criteria that you specify.
In this example we will also use a larger data set to demonstrate a more extensive application of the FILTER function in the real world.
You may be surprised at how often a situation comes up when you need to filter data where it is “not equal to” a certain number or piece of text that you specify.
In this example let’s say that we have a report/spreadsheet that shows data from sales calls that occur at your company, and we want to filter the data so that a specified sales rep (Bob) is NOT included in the filter output.
The task: Show sales call data for all sales reps, except Bob
The logic: Filter the range A2:E1000, where B2:B1000 DOES NOT equal the text, “Bob”
The formula: The formula below, is entered in the blue cell (G3), for this example
=FILTER(A3:E1000, B3:B1000<>»Bob»)
Notice that the filtered data on the right side of the image above does not contain any of the rows/calls that Bob was involved in.
Part 4: How to filter by date in Excel
Filtering by a date in Excel can be done in a couple of ways, which I will show you below. If you try to type a date into the FILTER function like you normally would type into a cell… the formula will not work correctly.
So you can either type the date that you want to filter by into a cell, and then use that cell as a reference in your formula… or you can use the DATE function.
When filtering by date you can use the same operators (>, <, =, etc…) as in other FILTER function applications. In Excel each different day/date is simply a number that is put into a special visual format. For example, in Excel, the date «06/01/2019» is simply the number «43,617», but displayed in date format. When you add one day to the date, this number increments by one each time… i.e «43,618» «43,619» «43,620»
So, one date can be considered to be «greater than» another date, if it is further in the future. Conversely, one date can be said to be «less than» another date, if it is further in the past.
In this first example we will filter by a date by using a cell reference. This is similar to the example we went over in part 2, but in this example instead of working with percentages, we are dealing with dates.
Let’s say that we want to filter a list of students, their test scores, and the dates that the tests were completed… and we want to show only tests that were taken before June (06/01/2019).
Filter by date in Excel example 1:
The task: Show only tests that were taken before June
The logic: Filter the range A3:C12, where C3:C12 is less than the date that is entered in cell G1 (06/01/2019)
The formula: The formula below, is entered in the blue cell (E3), for this example
=FILTER(A3:C12,C3:C12<G1)
Filter by date in Excel example 2:
In this second example on filtering by date in Excel we are using the same data as above, and trying to achieve the same results… but instead of using a cell reference, we will use the DATE function so that you can type enter the date directly into the FILTER function.
When using the DATE function to designate a certain date, you must first enter the year, then the month, and then the day… each separated by commas (shown below).
The task: Show only tests that were taken before June
The logic: Filter the range A3:C12, where C3:C12 is less than the date of (06/01/2019)
The formula: The formula below, is entered in the blue cell (E3), for this example
=FILTER(A3:C12,C3:C12<DATE(2019,6,1))
Filter by multiple conditions in Excel
When using the Excel FILTER function you may want to output a set of data that meets more than just one criteria. I will show you two ways to filter by multiple conditions in Excel, depending on the situation that you are in, and depending on how you want to formula to operate.
The normal way of adding another condition to your filter function, (as shown by the formula syntax in Excel), will allow you to set a second condition, where the first AND second condition must be met to be returned in filter output.
However I will also show you how to make a slight modification to the function so that you can choose to set a second condition where EITHER condition can be met to return/display in the filter function’s output/destination. (Separate the conditions with an asterisk to use AND logic, or separate the conditions with a plus sign to use AND logic.)
Part 5: Filtering by 2 conditions where BOTH MUST BE TRUE
In this example, we are going to filter a set of data, and only display rows where BOTH the first condition AND the second condition are met/true.
To use a second condition in this way (with AND logic), simply enter the second condition into the formula after the first condition, separated by an asterisk (*). Each condition must be inside of its own set of parenthesis (shown below).
When using the filter formula with multiple conditions like this, the columns that are referenced in each condition must be different.
In this scenario we want to filter a list that shows customers, their payment status, and their membership status… and to show only customers who have an active membership AND who are also late on their payment.
This will make sure that customers with an inactive membership who are still designated as being late on payment in the system… are not shown in the filter results, and not put on the list for being sent a «late payment» notice.
The task: Show a list of customers who are late on their payments, but only those with active memberships
The logic: Filter the range A3:C12, where B3:B12 equals the text “Late”, AND where C3:C12 equals the text “Active”
The formula: The formula below, is entered in the blue cell (E3), for this example
=FILTER(A3:C12,(B3:B12=»Late»)*(C3:C12=»Active»))
Part 6: Filtering by 2 conditions where EITHER ARE TRUE, not necessarily both
In this example we are going to filter a set of data and only display rows where EITHER the first condition OR the second condition are met/true.
To use a second condition in this way (with OR logic), simply enter the second condition into the formula after the first condition, separated by a plus sign. Each condition must be inside of its own set of parenthesis (shown below).
When using the FILTER formula in this way, you can choose criteria from the same or different columns.
In this scenario we want to filter the same customer data as shown in the previous example, but this time we want to show a list of customers who EITHER have an active membership OR who are late on their payment. This will give a list of customers who can be sent a notice for payment… including active members, or/also inactive members who are late on their final payment.
The task: Show a list of customers who are active members, and include customers who are late on payment even if they are not active members
The logic: Filter the range A3:C12, where B3:B12 equals the text “Late”, OR where C3:C12 equals the text “Active”
The formula: The formula below, is entered in the blue cell (E3), for this example
=FILTER(A3:C12, (B3:B12=»Late»)+(C3:C12=»Active»))
How to filter from another sheet in Excel
You may often find situations where you need to filter from another sheet in Excel, where your raw unfiltered data is on one tab, and your filter formula / filter output is on another tab.
This can be done by simply referring to a certain tab name when specifying the ranges in the filter. So where you would normally set a range like «A3:B», when referencing another sheet while filtering you specify the tab name by adding the tab name and an exclamation mark before the column/row portion of the range, like «TabName!A3:B»
However when the tab name has a space in it, it is necessary to use an apostrophe before and after the tab name, like ‘Tab Name’!A3:B.
Here is an example of how to filter data from another tab in Excel, where your filter formula will be on a different tab than the source range.
Let’s say that you have a list of employees and their schedule type (Full Time / Part Time) on one tab, and that you want to display a filtered list of full time employees on another tab.
The task: Filter the list of employees on the tab labeled «Filter List», and show a list of employees who have a full time schedule, on a separate tab
The logic: Filter the range ‘Filter List’!A3:B12, where the range ‘Filter List’!B3:B12 is equal to the text «Full Time»
The formula: The formula below, is entered in the blue cell (A3), for this example
=FILTER(‘Filter List’!A3:B12,’Filter List’!B3:B12=»Full Time»)
Here is a list of employees and their schedules, which is held on a tab labeled «Filter List»
And here is a filtered list of employees who have full time schedules, where the filter formula and output data are held on a separate tab.
Pop Quiz: Test your knowledge
Answer the questions below about the Excel FILTER function, to refine your knowledge! Scroll to the very bottom to find the answers to the quiz.
Question #1
Which of the following formulas uses a «cell reference» in the filter condition?
- =FILTER(A1:D15, B1:B15<0.6)
- =FILTER(A2:C15, C2:C15=F1)
- =FILTER(A1:P25, G1:G25=»Yes»)
Question #2
Which of the following formulas uses the «Not Equal» operator?
- =FILTER(C1:T50, J1:J50>100)
- =FILTER(A1:B75, B1:B75=»No»)
- =FILTER(S1:Z100, T1:T100<>»True»)
Question #3
True or False: If the column(s) in the source range and the column in the filter condition are not the same size (if one has more rows than the other), the formula will not work, and will display an error.
- True
- False
Question #4
Which of the following formulas uses AND logic, where BOTH conditions must be met to satisfy the filter criteria?
- =FILTER(C1:F20, (F1:F20=»Yes»)+(E1:E20=»Active»))
- =FILTER(C1:F35, (F1:F35=»Yes»)*(E1:E35=»Active»))
Question #5
Which of the following formulas uses OR logic, where EITHER condition can be met to satisfy the filter criteria?
- =FILTER(A1:K10, (K1:K10=»Yes»)*(J1:J10=»Active»))
- =FILTER(A3:K33, (K3:K33=»Yes»)+(J3:J33=»Active»))
Answers to the questions above:
Question 1: 2
Question 2: 3
Question 3: 1
Question 4: 2
Question 5: 2
This post will guide you how to extracts matched values using FILTER function in Microsoft Excel 365. And also will introduce that how to use FILTER function with same examples in Excel 365.
Table of Contents
- Excel Filter Function
- Entering FILTER Formula in Excel
- Excel filtering by a single criteria
- Example 1: How to use a number as a filter
- Example 2: How to filter in Excel by a cell value
- Example 3: Using Excel’s text filter
- Example 4: Using NOT EQUAL TO as a FILTER condition in Excel
- Example 5: How to use the date filter in Excel
- Example 6: Filtering by date in Excel
- Example 7: Filtering based on two Conditions
- Example 8: Filtering Based on Two Conditions using OR Logic
- Example 9: Filter Data in Excel from Another Sheet
- Example 10: Providing Maximum Number of Rows of Filtered Data
- Conclusion
- Related Functions
The FILTER function “filters” a set of data according to the conditions specified. The outcome is an array of values that match those in the original range. Simply said, the FILTER function extracts matched records from a collection of data using one or more logical checks. The include argument specifies logical tests, which might encompass a wide variety of formula conditions. For instance, FILTER may match data from a given year or month, data containing specific content, or numbers above a specified threshold.
=FILTER(array,include,[if empty])
Three parameters are required for the FILTER function: array
, include
, and if empty
.
Where:
- Array – This is required argument. The range or array to filter is specified by array.
- Include – This is required argument. Include one or more logical tests in the include These tests should return TRUE or FALSE depending on the array values evaluated.
- If_empty – This is option argument. The last input, if empty, specifies the value to return if FILTER does not discover any matching values. Typically, this is a message along the lines of “No records found,” although other values may also be returned. To show nothing, provide an empty string (“”).
Entering FILTER Formula in Excel
FILTER provides dynamic results. When the values in the source data change or the size of the source data array changes, the FILTER results are updated automatically. The results of FILTER will “leak” into numerous cells on the worksheet.
To filter data in Excel using the FILTER function, follow these steps:
Step1: To begin your filter formula, enter =FILTER(
.
Step2: Enter the address for the range of cells containing the data you want to filter, for example, A2:C10.
Step3: Type a comma, followed by the filter's condition
, such as B2:B20>3
(To specify a condition, type the address of the “criteria column,” such as C1:C, followed by an operator symbol such as greater than (>), and finally the criterion, such as the number 3.
Step4: Complete the parenthesis with a closing parenthesis and then hit enter on the keyboard. Your full formula will appear as follows: =FILTER(A2:C10, B2:B20>3)
I’ll begin with the fundamentals of utilizing the FILTER function, and then demonstrate some more advanced uses of the FILTER function. This article discusses the FILTER function as a formula entered into spreadsheet cells, not the filter command accessible from the toolbar and pop-up menus.
While using the FILTER function in Excel is almost identical to using it in Google Sheets, there are some subtle variations.
Excel filtering by a single criteria
To begin, let’s review how to use Excel’s FILTER function in its simplest version, with a single condition/criteria.
I’ll demonstrate how to filter data using a number, a cell value, a text string, or a date… and I’ll also demonstrate how to utilize a variety of “operators
” in the filter condition (Less than, Equal to, etc…).
Example 1: How to use a number as a filter
In this first demonstration of how to use the filter tool in Excel, we have a list of students and their grades and wish to create a filtered list of only students with flawless grades.
The assignment: Display a list of students and their grades, but only those who have earned an A.
The reasoning: Filter the range A2:B10 for values larger than 0.7 in the column B2:B10 (70 percent ). Then you can use the following FILTER formula,type:
=FILTER(A2:B10, B2:B10 >0.7)
Example 2: How to filter in Excel by a cell value
In this excel filter function example, we want to do the same thing as stated before, but rather than inputting the condition straight into the formula, we’re going to use a cell reference.
When you filter in Excel by a cell value, your sheet is configured in such a way that you may alter the value in the cell at any moment, which updates the value to which the filter criterion is tied.
In this example, rather than explicitly entering the value “0.8” into the formula, the filter criterion is set to cell G1, which contains the “0.8
” value.
The assignment: Display a list of students and their grades, but only those with a score of less than 80%
.
The reasoning: Filter the range A2:B10 to the extent that B2:B10 is smaller than the value supplied in column G1 (0.8).
You can use the following FILTER formula, type:
=FILTER(A2:B10, B2:B10 <G1)
Example 3: Using Excel’s text filter
In this example, we’ll utilize a text string as the filter formula’s criterion. This is fairly similar to using a number, except that the text to filter must be enclosed in quote marks.
We are filtering a list of customers and their payment status in this instance, and we want to present just customers with a payment status of “Payed
“.
The objective is to provide a list of clients that have paid on their payments.
The reasoning: Filter the range A2:B6 by substituting the string “ Payed
” for B2:B6.
The following formula: In this example, the formula below is typed in the cell (E1).
=FILTER(A3:B12, B2:B6=" Payed ")
Example 4: Using NOT EQUAL TO as a FILTER condition in Excel
Now that you have a working knowledge of how to use the filter function in Excel, here is another example of filtering by a string of text, but this time we will use the “not equal” operator (<>) to demonstrate how to filter a range and return data that is NOT equal to the criteria you set.
Additionally, we will utilize a bigger data set in this example to show a more comprehensive usage of the FILTER function in the real world.
You may be surprised at how often a circumstance arises in which you need to filter data that is “not equal to
” a certain number or piece of text.
In this example, we’ll use a report/spreadsheet to display data from sales calls that occur at your organization, and we’ll filter the data to exclude a certain sales person (Scott) from the result.
The assignment: Display sales call statistics for all sales representatives except ” Scott “.
The reasoning: Filter the range A2:C10
for values A2:A10
that DO NOT match the string “Scott “.
The following formula: In this example, the formula below is typed in the cell (E1).
=FILTER(A2:C10, A2:A10 <>"Scott")
Take note that the filtered data on the right side of the figure above does not include any of Scott
‘s rows/calls.
Example 5: How to use the date filter in Excel
Filtering in Excel by a date may be accomplished in a few different methods, which I will demonstrate below. If you attempt to put a date into the FILTER function in the same way that you would typically type into a cell, the formula will fail to operate properly.
Therefore, you may either enter the date you want to filter into a cell and then reference that cell in your formula… Alternatively, you may use the DATE function.
When filtering by date, the same operators (>, =, etc…) are available as they are in other FILTER function applications. Each individual day/date in Excel is merely a number that has been formatted differently. In Excel, for example, the date “01/30/2022
” is just the serial number “44591
” formatted as a date. Each time you add a day to the calendar, this number increases by one… For example, “44591” “44592” “44593”
Thus, if one date is farther in the future, it might be regarded “greater than
” another. In contrast, if one date is farther in the past, it might be considered to be “less than
” another.
In this example, we’ll use a cell reference to filter on a date. This is identical to the example discussed in Example 2, except that we are dealing with dates instead of percentages.
Consider the following scenario: we want to filter a list of students, their exam results, and the dates on which the tests were administered… and we wish to display only tests conducted before to June (05/01/2022).
=FILTER(A2:C10, C2:C10 <G1)
Example 6: Filtering by date in Excel
In this example of date filtering in Excel, we’ll use the same data as in the previous one and attempt to obtain the same results… however, instead of referencing a cell, we’ll utilize the DATE function, which allows you to put the date straight into the FILTER function.
When using the DATE function to provide a date, you must first input the year, followed by the month and finally the day… each denoted with a comma (shown below).
The assignment: Display only exams given before to May
The reasoning: Filter the range A2:C10
so that C2:C10
is less than or equal to the date (05/01/2022).
The following formula: In this example, the formula below is typed in the cell (D3).
=FILTER(A2:C10,C2:C10<DATE(2022,5,1))
Example 7: Filtering based on two Conditions
When utilizing the Excel FILTER function, you may want to produce data that fits many criteria. I’ll demonstrate two methods for filtering by several criteria in Excel, depending on the scenario and the desired behavior of the calculation.
The conventional method of adding another condition to your filter function (as shown by the Excel formula syntax) allows you to provide a second condition, where both the first AND second conditions must be fulfilled in order for the filter output to be returned.
However, I will demonstrate how to make a little tweak to the function so that you may choose to return/display in the filter function’s output/destination a second condition where EITHER condition might be satisfied. (To utilize AND logic, separate the conditions with an asterisk, or use a plus symbol to separate the criteria.)
In this example, we’re going to filter a collection of data and show those rows that satisfy BOTH the first and second conditions.
To utilize a second condition in this manner (using AND logic), just insert it after the first condition in the formula, separated by an asterisk (*)
. Each condition must be included in a separate pair of parentheses.
When a filter formula is used with several conditions, the columns referenced in each condition must be distinct.
In this case, we’d want to filter a list of clients based on their payment status and region… and to display those customers who are both current members AND paid on their payment status.
The objective is to provide a list of customers who are paid on payments, but only those who are in East region.
The reasoning: Filter the range A2:C6 such that B2:B6 equals the text “Paid
,” AND C2:C6 equals the text “East
“.
The following formula: In this example, the formula below is typed in the blue cell (E1).
=FILTER(A2:C6,( B2:B6="Paid")*( C2:C6 ="East"))
Example 8: Filtering Based on Two Conditions using OR Logic
In this example, we’re going to filter a collection of data and show those rows that satisfy either the first OR the second criterion.
To utilize a second condition in this manner (using OR logic), just insert it after the first condition in the formula, separated by a plus sign
. Each condition must be included in a separate pair of parentheses (shown below).
When used in this manner, the FILTER formula allows you to choose criteria from the same or separate columns.
In this case, we’re filtering the same customer data as in the previous example, but this time we’re displaying a list of customers who either are in East
region OR have paid on a payment. This will generate a list of clients to whom a payment notification have paid… whether they are current members or east region who have paid on their last payment.
The objective is to provide a list of customers who are in East
region, as well as customers who have paid on payments regardless of whether they are in East region.
The following formula: In this example, the formula below is typed in the cell (E1).
=FILTER(A2:C6, (B2:B6="Paid ")+(C2:C6=" East ")
Example 9: Filter Data in Excel from Another Sheet
You may often encounter instances in Excel when you need to filter data from another sheet, where your raw unfiltered data is on one tab and your filter formula is on another sheet.
This may be accomplished by simply referring to a certain sheet’s name when providing the filter’s ranges. Thus, while you would typically give a range such as “A1:B4,” when referring another sheet when filtering, you indicate the sheet name by preceding the range with the sheet name and an exclamation mark, as in “SheetName!A1:B4
“.
However, if the sheet name contains a space, an apostrophe must be used before and after the sheet name, as in "Sheet Name!" A1:B4
.
The following is an example of how to filter data in Excel from a separate sheet, where the filter formula is located on a different sheet than the source range.
Consider the following scenario: On one sheet, you have a list of customers and their payment status, and you wish to present a filtered list of paid customer on another sheet.
The job is to filter the list of customers on the Sheet3 and to display a separate list of customer names with a pay status on another worksheet.
The reasoning: Filter the range using the Sheet3
‘ command! A2:C6, where ‘ Sheet3′ is the range! B2:B6 corresponds to the phrase “Paid“.
The following formula: In this example, the formula below is typed in the cell (A3).
=FILTER(Sheet3! A2:C6, Sheet3!B2:B6="Paid")
Example 10: Providing Maximum Number of Rows of Filtered Data
If your FILTER formula provides a large number of rows but your worksheet is restricted in space and you are unable to erase the data below, you may limit the amount of rows returned by the FILTER function.
Let us demonstrate how it works using a simple formula that filter data that grade is less than 0.7 from filter value in Cell F1:
=FILTER(A2:C10, B2:B10<F1)
The preceding formula produces all records that it discovers, in this instance five rows. However, imagine you only have room for two. To output just the first two rows discovered, follow these steps:
Step1: Incorporate the FILTER formula into the INDEX function’s array parameter
Step2: Use a vertical array constant such as 1;2 as the row num input to INDEX. It specifies the number of rows to return (2 in our case).
Step3: Use a horizontal array constant such as 1,2 for the column num parameter. It defines the columns that should be returned (the first 2 columns in this example).
Step4: To account for any mistakes caused by the absence of data meeting your criteria, you may wrap your calculation in the IFERROR function.
The entire excel filter formula is as follows:
=IFERROR(INDEX(FILTER(A2:C10, B2:B10<F1), {1;2},{1,2}), "No Found")
Conclusion
This section discusses the FILTER function and its many uses. In general, when it comes to time management, we need this feature for a variety of reasons. I demonstrated various techniques with accompanying examples, however there might be countless further iterations based on a variety of circumstances. If you know of another way to use this function, please share it with us.
- Excel IFERROR function
The Excel IFERROR function returns an alternate value you specify if a formula results in an error, or returns the result of the formula.The syntax of the IFERROR function is as below:= IFERROR (value, value_if_error)…. - Excel INDEX function
The Excel INDEX function returns a value from a table based on the index (row number and column number)The INDEX function is a build-in function in Microsoft Excel and it is categorized as a Lookup and Reference Function.The syntax of the INDEX function is as below:= INDEX (array, row_num,[column_num])…
#Руководства
- 5 авг 2022
-
0
Как из сотен строк отобразить только необходимые? Как отфильтровать таблицу сразу по нескольким условиям и столбцам? Разбираемся на примерах.
Иллюстрация: Meery Mary для Skillbox Media
Рассказывает просто о сложных вещах из мира бизнеса и управления. До редактуры — пять лет в банке и три — в оценке имущества. Разбирается в Excel, финансах и корпоративной жизни.
Фильтры в Excel — инструмент, с помощью которого из большого объёма информации выбирают и показывают только нужную в данный момент. После фильтрации в таблице отображаются данные, которые соответствуют условиям пользователя. Данные, которые им не соответствуют, скрыты.
В статье разберёмся:
- как установить фильтр по одному критерию;
- как установить несколько фильтров одновременно и отфильтровать таблицу по заданному условию;
- для чего нужен расширенный фильтр и как им пользоваться;
- как очистить фильтры.
Фильтрация данных хорошо знакома пользователям интернет-магазинов. В них не обязательно листать весь ассортимент, чтобы найти нужный товар. Можно заполнить критерии фильтра, и платформа скроет неподходящие позиции.
Фильтры в Excel работают по тому же принципу. Пользователь выбирает параметры данных, которые ему нужно отобразить, — и Excel убирает из таблицы всё лишнее.
Разберёмся, как это сделать.
Для примера воспользуемся отчётностью небольшого автосалона. В таблице собрана информация о продажах: характеристики авто, цены, даты продажи и ответственные менеджеры.
Скриншот: Excel / Skillbox Media
Допустим, нужно показать продажи только одного менеджера — Соколова П. Воспользуемся фильтрацией.
Шаг 1. Выделяем ячейку внутри таблицы — не обязательно ячейку столбца «Менеджер», любую.
Скриншот: Excel / Skillbox Media
Шаг 2. На вкладке «Главная» нажимаем кнопку «Сортировка и фильтр».
Скриншот: Excel / Skillbox Media
Шаг 3. В появившемся меню выбираем пункт «Фильтр».
Скриншот: Excel / Skillbox Media
То же самое можно сделать через кнопку «Фильтр» на вкладке «Данные».
Скриншот: Excel / Skillbox Media
Шаг 4. В каждой ячейке шапки таблицы появились кнопки со стрелками — нажимаем на кнопку столбца, который нужно отфильтровать. В нашем случае это столбец «Менеджер».
Скриншот: Excel / Skillbox Media
Шаг 5. В появившемся меню флажком выбираем данные, которые нужно оставить в таблице, — в нашем случае данные менеджера Соколова П., — и нажимаем кнопку «Применить фильтр».
Скриншот: Excel / Skillbox Media
Готово — таблица показывает данные о продажах только одного менеджера. На кнопке со стрелкой появился дополнительный значок. Он означает, что в этом столбце настроена фильтрация.
Скриншот: Excel / Skillbox Media
Чтобы ещё уменьшить количество отображаемых в таблице данных, можно применять несколько фильтров одновременно. При этом как фильтр можно задавать не только точное значение ячеек, но и условие, которому отфильтрованные ячейки должны соответствовать.
Разберём на примере.
Выше мы уже отфильтровали таблицу по одному параметру — оставили в ней продажи только менеджера Соколова П. Добавим второй параметр — среди продаж Соколова П. покажем автомобили дороже 1,5 млн рублей.
Шаг 1. Открываем меню фильтра для столбца «Цена, руб.» и нажимаем на параметр «Выберите».
Скриншот: Excel / Skillbox Media
Шаг 2. Выбираем критерий, которому должны соответствовать отфильтрованные ячейки.
В нашем случае нужно показать автомобили дороже 1,5 млн рублей — выбираем критерий «Больше».
Скриншот: Excel / Skillbox Media
Шаг 3. Дополняем условие фильтрации — в нашем случае «Больше 1500000» — и нажимаем «Применить фильтр».
Скриншот: Excel / Skillbox Media
Готово — фильтрация сработала по двум параметрам. Теперь таблица показывает только те проданные менеджером авто, цена которых была выше 1,5 млн рублей.
Скриншот: Excel / Skillbox Media
Расширенный фильтр позволяет фильтровать таблицу по сложным критериям сразу в нескольких столбцах.
Это можно сделать способом, который мы описали выше: поочерёдно установить несколько стандартных фильтров или фильтров с условиями пользователя. Но в случае с объёмными таблицами этот способ может быть неудобным и трудозатратным. Для экономии времени применяют расширенный фильтр.
Принцип работы расширенного фильтра следующий:
- Копируют шапку исходной таблицы и создают отдельную таблицу для условий фильтрации.
- Вводят условия.
- Запускают фильтрацию.
Разберём на примере. Отфильтруем отчётность автосалона по трём критериям:
- менеджер — Шолохов Г.;
- год выпуска автомобиля — 2019-й или раньше;
- цена — до 2 млн рублей.
Шаг 1. Создаём таблицу для условий фильтрации — для этого копируем шапку исходной таблицы и вставляем её выше.
Важное условие — между таблицей с условиями и исходной таблицей обязательно должна быть пустая строка.
Скриншот: Excel / Skillbox Media
Шаг 2. В созданной таблице вводим критерии фильтрации:
- «Год выпуска» → <=2019.
- «Цена, руб.» → <2000000.
- «Менеджер» → Шолохов Г.
Скриншот: Excel / Skillbox Media
Шаг 3. Выделяем любую ячейку исходной таблицы и на вкладке «Данные» нажимаем кнопку «Дополнительно».
Скриншот: Excel / Skillbox Media
Шаг 4. В появившемся окне заполняем параметры расширенного фильтра:
- Выбираем, где отобразятся результаты фильтрации: в исходной таблице или в другом месте. В нашем случае выберем первый вариант — «Фильтровать список на месте».
- Диапазон списка — диапазон таблицы, для которой нужно применить фильтр. Он заполнен автоматически, для этого мы выделяли ячейку исходной таблицы перед тем, как вызвать меню.
Скриншот: Excel / Skillbox Media
- Диапазон условий — диапазон таблицы с условиями фильтрации. Ставим курсор в пустое окно параметра и выделяем диапазон: шапку таблицы и строку с критериями. Данные диапазона автоматически появляются в окне параметров расширенного фильтра.
Скриншот: Excel / Skillbox Media
Шаг 5. Нажимаем «ОК» в меню расширенного фильтра.
Готово — исходная таблица отфильтрована по трём заданным параметрам.
Скриншот: Excel / Skillbox Media
Отменить фильтрацию можно тремя способами:
1. Вызвать меню отфильтрованного столбца и нажать на кнопку «Очистить фильтр».
Скриншот: Excel / Skillbox Media
2. Нажать на кнопку «Сортировка и фильтр» на вкладке «Главная». Затем — либо снять галочку напротив пункта «Фильтр», либо нажать «Очистить фильтр».
Скриншот: Excel / Skillbox Media
3. Нажать на кнопку «Очистить» на вкладке «Данные».
Скриншот: Excel / Skillbox Media
Научитесь: Excel + Google Таблицы с нуля до PRO
Узнать больше