This guide will explain how to filter integers in Google Sheets.
Table of Contents
Filtering in Google Sheets is a powerful method for managing and analysing your data. By applying filters, you can selectively view specific rows in a spreadsheet while temporarily hiding others, making it easier to focus on relevant information.
While Google Sheets doesn’t offer a direct filter option for integers, we can use a combination of formulas and the built-in filter functionality to achieve this.
In this guide, we will provide a step-by-step tutorial on how to filter integers in your Google Sheets document. We will cover two methods: using the
FILTER function and utilizing the Filter command.
The Anatomy of the FILTER Function
The syntax of the
FILTER function is as follows:
=FILTER(range, condition1, [condition2, ...])
Let’s look at each argument to understand how to use the
- range refers to the range of values you want to filter.
- condition1 must be a column or row containing TRUE or FALSE values corresponding to a selected column or row of the range. It can also be an array formula that evaluates to TRUE or FALSE values,
- condition2, … are optional additional conditions to consider in your filter. Rows or columns in your range must pass all conditions to appear in the output.
- Do note that all condition arguments must have the same array length as the range argument.
A Real Example of Filtering Integers in Google Sheets
Let’s explore a few methods we can use when we need to filter integers in Google Sheets.
Using the FILTER Function
In the table above, we have a range of values where we want to output a new range containing only the integers.
We can use the following
FILTER function to filter for only integers:
FILTER function above, we’ve specified that we want to filter the range A2:A21 based on a certain condition. The condition argument A2:A21=INT(A2:A21) indicates that we are only interested in cells with values equal to their integer form. With this condition, cells that are already integers will return TRUE, while non-integer numbers will return FALSE.
In the table above, we added our
FILTER function in cell C2 to output a new range of numbers containing only integers from our original dataset.
Using the Filter Tool
We can also use the built-in Filter tool to apply a custom formula in our target range to hide all non-integer values.
In the example above, we applied a filter to our set of numbers in column A. To ensure that only integers are displayed, we’ll use the custom formula A2=INT(A2). In the next section, we’ll explain how to add this custom formula as a condition within a filtered range.
Click on the link below to create your own copy of our examples.
Head to the next section to read our step-by-step tutorial on how to filter integers in Google Sheets.
How to Filter Integers in Google Sheets
- Select the cell where you want to place the
FILTERfunction. Ensure there is enough space below this cell to accommodate the
In this example, we’ll use cell C2 for our
- Type “=FILTER(“ in the selected cell to start the
- For the first argument of the
FILTERfunction, type the range you want to filter for integers.
In this example, we’ll use the range A2:A21.
- Next, we’ll type out the condition statement to use for our
FILTERfunction. The easiest way to check if a number is an integer is to use the
INTfunction to convert the number into an integer and compare the result with the original number.
If the two numbers are equal, then the original number must be an integer.
In this example, we want to know if the values in the range A2:A21 are integers. We can use the condition A2:A21=INT(A2:A21) to compare each value in the range with its integer equivalent.
- Hit the Enter key to evaluate the function.
The formula should return a filtered array with only the integers from the target range.
- Another way we can filter integers in Google Sheets is by using the Filter tool and a custom formula.
Select the range you would like to filter and click Data > Create a filter.
- Click on the filter icon in the header of the selected column. Under the Filter by condition section, click the Custom formula is option from the dropdown menu.
We’ll use the formula =A2=INT(A2) to help filter integers in the range. Click on OK to apply the new filter.
- The filtered range should now show all the integer values in the range
These are all the steps you need to know to start filtering integers in Google Sheets.
- Can I use conditional formatting to highlight integers in a range?
Yes, you can use conditional formatting to highlight integers in a range. We can use the custom formula =A1=INT(A1) to highlight cells that contain integer values. You can access the conditional formatting tool by clicking Format > Conditional formatting.
- Is it possible to filter integers in a range that also meets other criteria?
Yes, you can combine integer filtering with other criteria. For instance, if you want to filter integers in a range that is non-negative, use a formula like =AND(A1=INT(A1), A1>=0) as a condition for the
FILTERfunction or Filter tool.
To learn more about using Google Sheets spreadsheets for filtering values, you can read our post on how to use the FILTER function in Google Sheets.
That’s all for this guide! Be sure to check out our library of spreadsheet resources, tips, and tricks!