The FILTER function in Google Sheets helps you filter and return rows in a range that meet specified criteria. You can also add multiple criteria across columns. The FILTER function generates a new set of data while keeping the original data intact.
Looking for the filter button or filter views rather than a formula? See how to filter Google Sheets without affecting other users.
If you do not find the information you are looking for in this post, you can check out 100+ Functions & Formulas for Google Sheets & Excel Basics.
Working in Excel instead? The Excel FILTER function follows the same logic and adds an optional argument for what to show when nothing matches.
What is the syntax of the filter function?
This is the basic structure of the filter function:
- range – a reference to the range of cells that the function filters.
- condition1 – an array, row or column equal in length or width as that of the corresponding first row or column of range respectively. It contains evaluated TRUE or FALSE values.
- condition2 … – optional and additional arrays, rows or columns containing evaluated TRUE or FALSE values to specify if the corresponding row or column within the range needs consideration for the filtering process.
Please note that you can’t use both row and column conditions in the same function. All conditions should be either columns or rows, and the FILTER function doesn’t let you mix them.
How to use the FILTER function
Below is the sample data on which I will try various combinations of the FILTER function to demonstrate its behaviour.
Case 1: FILTER with one condition
In this first Google Sheets FILTER example, I will use just one condition and see how it works. This is the formula I will use:
=FILTER(A2:D10,A2:A10="Vegetables")
The condition to filter on the first column is “Vegetables”. So the FILTER function fetches all those rows where the first column has the value “Vegetables”.
I placed the function in cell F1, and accordingly the returned data flows from F1 towards the right and further down. The number of columns the function matches that of the input range. However, the number of rows might vary based on the filter conditions.
So, it is very important to keep cells free of data where you expect the data to flow. Otherwise, the function returns a #REF! Error as demonstrated in the screenshot below.
Case 2: Filter with two conditions
Let’s add one more filter condition and see what happens.
=FILTER(A2:D10,A2:A10="Vegetables",C2:C10>20)
I essentially asked Google Sheets to show those rows that belong to the “Vegetables” category and whose energy is greater than 20 Kcal, and the FILTER function obliged!
Case 3: Google Sheets FILTER, multiple conditions
I will add one more condition and see the outcome.
=FILTER(A2:D10,A2:A10="Vegetables",C2:C10>20,D2:D10<0.3)
And it works like a charm!
Case 4: Filter with “or” condition
So far all the examples have been using “and” conditions – that is, the data has to meet all the conditions specified in order for it to pass the filter.
However, there is another option – you can use “or” conditions that will work for data that meets any one of multiple conditions. The example below demonstrates this.
=FILTER(A2:D10,(A2:A10="Vegetables")+(D2:D10<0.3))
As you can see, the filter here is finding any item that is a vegetable OR has less than 0.3g of fat. Because only one condition needs to be met, Apple and Broccoli are both included even though an apple is not a vegetable, and broccoli has more than 0.3g of fat.
In order to use an OR condition, all you need to do is put the conditions in brackets and add them together with a plus sign, instead of separating them by a comma.
Case 5: Largest values
Another helpful way of using the FILTER function is to find the top few items in any category.
In the example below, I’ve filtered the data to find the three foods with the largest amount of calories.
=FILTER(A2:D10,(C2:C10>=LARGE(C2:C10,3)))
This is achieved by using the FILTER function in combination with the LARGE function, which identifies the largest numbers in a dataset.
I’ve used the LARGE function to identify the three largest calorie numbers, and then filtered the data according to these. You can use this method to filter for any number of the largest or smallest values.
Case 6: Sorting filtered results
In the previous example, I found the top 3 foods with the most calories. But as you could see, the results weren’t shown in order from most calorie-dense to least.
To sort the results of the FILTER function, you can combine it with the SORT function.
=SORT(FILTER(A2:D10,(C2:C10>=LARGE(C2:C10,3))),3,FALSE)
All I’ve done here is added the SORT function in front of the FILTER function, then told the SORT function to sort based on column 3 in descending order (by indicating False).
Case 7: What if there is no match?
Of course, not getting any matches generates an error. This is what it looks like.
Case 8: Breaking the rules
You already know you can’t input row and column type conditions within a single FILTER function. I’ll try that anyway and see what Google Sheets has to say.
How to filter on multiple conditions in Google Sheets
Cases 2 to 4 above show the two ways to combine conditions in the Sheets FILTER function. Separate the conditions with commas when a row has to meet all of them (AND logic). Put each condition in parentheses and add them together with a plus sign when meeting any one of them is enough (OR logic).
The examples below use a sales table in A2:H1001, with the amount in column F, the sales agent in column G, and the date of the sale in column H.
Filter by a date range
1. In an empty cell, type the FILTER function and select the range.
2. Add the condition – column H must be between June 1st and June 30th of 2022 – and close the parenthesis. Type the ISBETWEEN function and use the date column as the first parameter.
3. For the second argument, use the DATE function to provide the start date: 2022, 6, 1. For the third argument, do the same with the end date: 2022, 6, 30.
4. Skip the third and fourth parameters to ensure the filter includes the start and end dates. Close the parentheses and press ‘Enter’ to see the results.
The finished formula is =FILTER(A2:H1001,ISBETWEEN(H2:H1001,DATE(2022,6,1),DATE(2022,6,30))), and it returns every sale dated in June 2022. For more ways to build dates inside a formula, see how to use the DATE function in Google Sheets.
AND logic: match every condition
1. Type the FILTER function and select the range.
2. Add the first condition: values in column G must equal “Agent1”.
3. Add the second condition: values in column H must be on or after March 15, 2022. Use the DATE function for the date, as in DATE(2022,3,15). If you type 3/15/2022 straight into the formula, Sheets reads it as 3 divided by 15 divided by 2022, so every date passes the condition.
4. Close the parenthesis and press ‘Enter’ to see the results. The finished formula is =FILTER(A2:H1001,G2:G1001="Agent1",H2:H1001>=DATE(2022,3,15)), and it returns only Agent1’s sales from March 15, 2022 onward.
You can write the same AND filter with an asterisk instead of a comma: =FILTER(A2:H1001,(G2:G1001="Agent1")*(H2:H1001>=DATE(2022,3,15))). Each condition returns TRUE or FALSE, and multiplying them keeps only the rows where both are TRUE.
OR logic: match any condition
To keep rows that meet at least one condition, put each condition in parentheses and add them together with a plus sign, as in Case 4. This formula returns every sale made by Agent1 or Agent3:
=FILTER(A2:H1001,(G2:G1001="Agent1")+(G2:G1001="Agent3"))
Each condition returns 1 for TRUE and 0 for FALSE, so a row passes when the sum is 1 or more. You can mix both kinds of logic in one formula. This one returns sales of $1,000 or more made by either agent:
=FILTER(A2:H1001,((G2:G1001="Agent1")+(G2:G1001="Agent3"))*(F2:F1001>=1000))
Google Sheets FILTER not working?
Let’s go over a short checklist to help you troubleshoot common issues with the filter function:
- Check the syntax of your filter function. Ensure that you’ve correctly specified the range of data you want to filter and that the conditions or criteria are accurately defined.
- Verify that your data range is correct and points to the intended rows and columns.
- Ensure there are no hidden rows or columns within your data range, this can affect the outcome of the filter function.
- Examine the filtering criteria you’ve set for filtering your data.
If this doesn’t work, AI might be the answer. For a great prompt to troubleshoot spreadsheet functions check out 15 awesome Chat GPT prompts for spreadsheet users.
You are officially a FILTER builder!
That’s how to get started with the Google Sheets FILTER function. Looking for more spreadsheet tutorials and tips? Check out our other posts below!
The UNIQUE function in Google Sheets can be of great help to you as well. Check it out in our blog post: How to use the UNIQUE function in Google Sheets.



