Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel for iPad Excel for iPhone Excel for Android tablets Excel for Android phones More…Less
The FILTER function allows you to filter a range of data based on criteria you define.
In the following example we used the formula =FILTER(A5:D20,C5:C20=H2,»») to return all records for Apple, as selected in cell H2, and if there are no apples, return an empty string («»).
The FILTER function filters an array based on a Boolean (True/False) array.
=FILTER(array,include,[if_empty])
Argument |
Description |
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) |
Notes:
-
An array can be thought of as a row of values, a column of values, or a combination of rows and columns of values. In the example above, the source array for our FILTER formula is range A5:D20.
-
The FILTER function will return an array, which will spill if it’s the final result of a formula. This means that Excel will dynamically create the appropriate sized array range when you press ENTER. If your supporting data is in an Excel table, then the array will automatically resize as you add or remove data from your array range if you’re using structured references. For more details, see this article on spilled array behavior.
-
If your dataset has the potential of returning an empty value, then use the 3rd argument ([if_empty]). Otherwise, a #CALC! error will result, as Excel does not currently support empty arrays.
-
If any value of the include argument is an error (#N/A, #VALUE, etc.) or cannot be converted to a Boolean, the FILTER function will return an error.
-
Excel has limited support for dynamic arrays between workbooks, and this scenario is only supported when both workbooks are open. If you close the source workbook, any linked dynamic array formulas will return a #REF! error when they are refreshed.
Examples
FILTER used to return multiple criteria
In this case, we’re using the multiplication operator (*) to return all values in our array range (A5:D20) that have Apples AND are in the East region: =FILTER(A5:D20,(C5:C20=H1)*(A5:A20=H2),»»).
FILTER used to return multiple criteria and sort
In this case, we’re using the previous FILTER function with the SORT function to return all values in our array range (A5:D20) that have Apples AND are in the East region, and then sort Units in descending order: =SORT(FILTER(A5:D20,(C5:C20=H1)*(A5:A20=H2),»»),4,-1)
In this case, we’re using the FILTER function with the addition operator (+) to return all values in our array range (A5:D20) that have Apples OR are in the East region, and then sort Units in descending order: =SORT(FILTER(A5:D20,(C5:C20=H1)+(A5:A20=H2),»»),4,-1).
Notice that none of the functions require absolute references, since they only exist in one cell, and spill their results to neighboring cells.
Need more help?
You can always ask an expert in the Excel Tech Community or get support in the Answers community.
See Also
RANDARRAY function
SEQUENCE function
SORT function
SORTBY function
UNIQUE function
#SPILL! errors in Excel
Dynamic arrays and spilled array behavior
Implicit intersection operator: @
Need more help?
#Руководства
- 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
Узнать больше
Advanced filter in Excel provides more opportunities for managing on data management spreadsheets. It is more complex in settings, but much more effective in action.
Using a standard filter, a Microsoft Excel user can solve not all of the tasks that are set. There is no visual display of the applied filtering conditions. It is not possible to apply more than two selection criteria. You can not filter the duplicate values to leave only unique records. And the criteria themselves are schematic and simple. The functionality of the extended filter is much richer. Let’s take a closer look at its possibilities.
How to make the advanced filter in Excel?
The advanced filter allows you to analysis data on an unlimited set of conditions. With this tool, the user can:
- to specify more than two selection criteria;
- to copy the result of filtering to another sheet;
- to set the condition of any complexity with the helping of formulas;
- to extract the unique values.
The algorithm for applying the extended filter is simple.
- To make the table with the original data or to open an existing one. Like so:
- To create the condition table. The features: the header line is the same with the «cap» of the filtered table. To avoid errors, need to copy the header line in the source table and paste it on the same sheet (side, top, underarm) or on another sheet. We enter the selection criteria into the condition table.
- Go to the «DATA» tab — «Sort and filter» — «Advanced». If the filtered information should be displayed on another sheet (NOT where the source table is), then you need to run the extended filter from another sheet.
- In the «Advanced Filter» window that opens, to select the method of processing information (on the same sheet or on the other one), set the initial range (the table 1, example) and the range of conditions (the table 2, conditions). The header lines must be included in the ranges.
- To close the «Advanced Filter» window, click OK. We see the result.
The top table is the result of the filtering. The lower nameplate with the conditions is given for clarity near.
How to use the advanced filter in Excel?
To cancel the action of the advanced filter, we place the cursor anywhere in the table and press Ctrl + Shift + L or «DATA» — «Sort and Filter» — «Clear».
We will find using the «Advanced Filter» tool information on the values that contain the word «Set».
In the table of conditions we bring in the criteria. For example, these are:
The program in this case will search for all information on the goods, in the title of which there is the word «Set».
To search for the exact value, you can use the «=» sign. We enter the following criteria in the condition table:
Excel sees the «=» as a signal: the user will set the formula now. In order for the program to work correctly, the following should be written in the formula line: =»=Set of covers 6″.
After using the «Advanced Filter»:
We filter the source table by the condition «OR» for different columns now. The operator «OR» is also in the tool «AutoFilter». But there it can be used within the single column.
In the condition label we introduce the selection criteria: =»=Set of covers 6″. (In the column «Name of product») and = «<2.5$» (in the column «Price»). That is, the program must select those values that contain the EXACTLY information about the good «Set of covers 6 ». OR to the information about the goods, which price is <2.5.
Please note: the criteria must be written under the corresponding headings in the DIFFERENT lines.
The result of selection:
The advanced filter allows you to use as a criterion of a formula. Let’s consider the example.
Selection of the line with the maximum indebtedness: =MAX(Table1[Debt]).
So we get the results as after running several filters on the one Excel sheet.
How to make few filters in Excel?
Let’s create the filter by several values. To do this, we enter in the table of conditions several criteria for selecting data:
Apply the tool «Advanced Filter»:
Now from the table with the selected data we will extract new information, which was selected according to other criteria. There are only shipping date for autumn 2015 (from September to November). Example:
We introduce a new criterion in the condition table and apply the filtering tool. The initial range — is the table with data selected according to the previous criterion. This is how the filter is performed across on several columns.
To use few filters, you can create several condition tables on the new sheets. The method of implementation depends from the task which was set by user.
How to make the filter in Excel by lines?
By standard methods — you may not do it by any ways. Microsoft Excel selects data only in columns. Therefore, we need to look for other solutions.
Here are some examples of string criteria for the extended filter in Excel:
- Convert to the table. For example, from three rows make a list of three columns and apply the filtering to the transformed version.
- Use formulas to display exactly the data in the string that are needed. For example, make some indicator drop-down list. And in the next cell, enter the formula using the IF function. When a certain value is selected from the drop-down list, its parameter appears next to it.
To give an example of how the filter works by rows in Excel, we are creating the label:
For the list of products, we create the drop-down list:
If necessary, learn how to create a drop-down list in Excel.
Above the table with the original data, we insert an empty line. In the cells, we introduce the formula that will show which columns the information is taken from.
Next to the drop-down list box, we enter the following formula:
Its task is select from the table those values, that correspond to a certain good.
Download examples of advanced filtering
Thus, using the tool «Drop-down list» and built-in functions Excel selects data in rows according to a certain criterion.
Filter your Excel data if you only want to display records that meet certain criteria.
1. Click any single cell inside a data set.
2. On the Data tab, in the Sort & Filter group, click Filter.
Arrows in the column headers appear.
3. Click the arrow next to Country.
4. Click on Select All to clear all the check boxes, and click the check box next to USA.
5. Click OK.
Result. Excel only displays the sales in the USA.
6. Click the arrow next to Quarter.
7. Click on Select All to clear all the check boxes, and click the check box next to Qtr 4.
8. Click OK.
Result. Excel only displays the sales in the USA in Qtr 4.
9. To remove the filter, on the Data tab, in the Sort & Filter group, click Clear. To remove the filter and the arrows, click Filter.
There’s a quicker way to filter Excel data.
10. Select a cell.
11. Right click, and then click Filter, Filter by Selected Cell’s Value.
Result. Excel only displays the sales in the USA.
Note: simply select another cell in another column to further filter this data set.
Data Filter in Excel (Table of Contents)
- Data Filter in Excel
- Uses of Data Filter in Excel
- Types of Data Filter in Excel
- How to Add Data Filter in Excel?
Data Filter in Excel
Data Filter in excel has many purposes apart from filtering the data. Although its main purpose is to filter the data as per the required condition, apart from this, we can sort, arrange the data, filter the data as per the color of cells or fonts or any condition available in the Text filter in the column where the filter is applied. To apply the filter, first, select the row where we need a filter, then from the Data menu tab, select Filter from Sort & Filter section. Or else we can apply filter by using short cut key ALT + D + F + F simultaneously or Ctrl + Shift + L together.
Uses of Data Filter in Excel
- If the table or range contains a huge number of datasets, it’s very difficult to find & extract the precise requested information or data. In this scenario, the Data Filter helps out.
- Data Filter in Excel option helps out in many ways to filter the data based on text, value, numeric or date value.
- The Data Filter option is very helpful to sort out data with simple drop-down menus.
- The Data Filter option is significant to temporarily hide few data sets in a table so that you can focus on the relevant data we need to work on.
- Filters are applied to rows of data in the worksheet.
- Apart from multiple filtering options, auto-filter criteria provide the Sort options also relevant to a given column.
Definition
Data Filter in Excel: it’s a quick way to display only the relevant or specific information which we need & temporarily hide irrelevant information or data in a table.
To activate the Excel data filter for any data in excel, select the entire data range or table range and click on the Filter button in the Data tab in the Excel ribbon.
(keyboard shortcut – Control + Shift + L)
Types of Data Filter in Excel
There are three types of data filtering options:
1. Data Filter Based On Text Values – It is used when the cells contain TEXT values; it has below mentioned Filtering Operators (Explained in example 1).
Apart from multiple filtering options in a text value, AutoFilter criteria provide the Sort options also relevant to a given column. i.e. Sort by A to Z, Sort by Z to A, and Sort by Color.
2. Data Filter Based on Numeric Values – It is used when the cells contain numbers or numeric values
It has below mentioned Filtering Operators (Explained in example 2)
Apart from multiple filtering options in Numeric value, AutoFilter criteria provide the Sort options also relevant to a given column. i.e. Sort by Smallest to Largest, Sort by Largest to Smallest, and Sort by Color.
3. Data Filter Based On Date Values – It is used when the cells contain date values (Explained in example 3)
Apart from multiple filtering options in date value, AutoFilter criteria provide the Sort options also relevant to a given column. i.e. Sort by Oldest to Newest, Sort by Newest to Oldest, and Sort by Color.
How to Add Data Filter in Excel?
This Data Filter is very simple easy to use. Let us now see how to Add a Data Filter in Excel with the help of some examples.
You can download this Data Filter Excel Template here – Data Filter Excel Template
Example #1 – Filtering Based on Text Values or Data
In the below-mentioned example, the Mobile sales data table contains a huge list of datasets.
Initially, I have to activate the Excel data filter for the Mobile sales data table in excel, select the entire data range or table range, and click on the Filter button in the Data tab in the Excel ribbon.
Or click (keyboard shortcut – Control + Shift + L)
When you click on Filter, each column in the first row will automatically have a small drop-down button or filter icon added at the right corner of the cell i.e.
When excel identifies that the column contains text data, it automatically displays the option of text filters. In the mobile sales data, if I want sales data in the northern region only, irrespective of date, product, sales rep & units sold. I need to select the filter icon in the region header; I have to uncheck or deselect all the regions except the north region. It returns mobile sales data in the northern region only.
Once a filter is applied in the region column, Excel pinpoints you that table is filtered on a particular column by adding a funnel icon to the region column’s drop-down list button.
I can further filter based on brand & sales rep data. Now with this data, I further filter in the product region where I want the sales of the Nokia brand in the north region only irrespective of the sales rep, units sold & date.
I have to just apply the filter in the product column apart from the region column. I have to uncheck or deselect all the products except the NOKIA brand. It returns Nokia sales data in the north region.
Once the filter is applied in the product column, Excel pinpoints you that table is filtered on a particular column by adding a funnel icon to the product column’s drop-down list button.
Example #2 – Filtering Based on Numeric Values or Data
When excel identifies that the column contains NUMERIC values or data, it automatically displays the option of text filters.
If I want data of units sold in the mobile sales data, which is more than 30 units, irrespective of date, product, sales rep & region. For that, I need to select the filter icon in the units sold header; I have to select the number of filters, and under that greater than an option.
Once greater than option under number filter is selected, pop up appears, i.e. Custom auto filter, in that under the unit sold, we want datasets of more than 30 units sold, so enter 30. Click ok.
It returns mobile sales data based on the units sold. i.e. more than 30 units only.
Once the filter is applied in the units sold column, Excel pinpoints you that table is filtered on a particular column by adding a funnel icon to the units sold column drop-down list button.
Sales data can be further Sorted by Smallest to Largest or Largest to Smallest in units sold.
Example #3 – Filtering based on Date Value
When excel identifies that the column contains DATE values or data, it automatically displays the option of DATE filters.
Date filter lets you filter dates based on any date range. For example, you can filter on conditions such dates by day, week, month, year, quarter, or year-to-date.
In the mobile sales data, if I want mobile sales data only on or for the date value, i.e. 01/15/17, irrespective of units sold, product, sales rep & region. I need to select the filter icon in the date header; I have to select the date filter, and under that equals to option.
Custom AutoFilter dialog box will appear; enter a date value manually, i.e. 01/15/17
Click ok. It returns mobile sales data only on or for the date value, i.e. 01/15/17
Once a filter is applied in the date column, Excel pinpoints you that table is filtered on a particular column by adding a funnel icon to the date column drop-down list button.
Things to Remember
- Data filter helps out to specify the required data that you want to display. This process is also called “Grouping of data, ” which helps out better analyse your data.
- Excel data can also be used to search or filter a data set with a specific word in a text with the help of a custom auto filter on the condition it contains ‘a’ or any relevant word of your choice.
- Data Filter option can be removed with the below-mentioned steps:
Go to the Data tab > Sort & Filter group and click Clear.
A Data Filter option is Removed.
- Excel data filter option can filter the records by multiple criteria or conditions, i.e. by filtering multiple column values (more than one column) explained in example 1.
- Excel data filter helps out to sort out blank & non-blank cells in the column.
- Data can also be filtered out with the help of wild characters, i.e.? (question mark) & * (asterisk) & ~ (tilde)
Recommended Articles
This has been a guide to a Data Filter in Excel. Here we discuss how to Add a Data Filter in Excel with excel examples and downloadable excel templates. You may also look at these useful functions in Excel –
- Excel Filter Shortcuts
- Excel Column Filter
- Advanced Filter in Excel
- VBA Filter