Session 2 - Data Literacy: Beyond the Basics

3. Visulising your Data
3.5. Googlesheets formula: =FILTER
Using Google Sheets: Filtering Data with =FILTER
This guide explains how to use the FILTER function in Google Sheets to extract data from a range based on specific criteria. This is incredibly useful for creating targeted views of your data, analyzing subsets of information, and generating dynamic reports.
What is =FILTER?
FILTER allows you to select rows from a range that meet one or more conditions. It returns a new range containing only the rows that satisfy the criteria. The original data remains unchanged.
Syntax:
=FILTER(range, condition1, [condition2, ...])
Let's break down each part:
=FILTER: This is the function name.range: This is the range of cells you want to filter (e.g., "A1:D10", "Sheet1!A1:B5").condition1: This is the first condition that must be met. It usually involves a comparison (e.g., "A1:A10 > 70", "B1:B10 = "Maths"").[condition2, ...]: (Optional) Additional conditions. All conditions must be true for a row to be included in the filtered result.
Step-by-Step Example:
- Open the Spreadsheet: Open the Google Sheet containing the data you want to filter.
- Enter the Formula: In the cell where you want the filtered data to begin, type the
FILTERformula. For example, to filter data in the range A1:D10 where values in column C are greater than 80:=FILTER(A1:D10, C1:C10 > 80) - Data Appears: The rows that meet the condition(s) will appear in the destination range.
-
AND Logic (Multiplication
*): In Google Sheets'FILTERfunction, when you multiply two or more conditions, it's treated as an "AND" operation. This means that all the conditions must be true for a row to be included in the filtered results. Think of "TRUE" as 1 and "FALSE" as 0. When you multiply conditions, if even one condition is FALSE (0), the result is 0 (FALSE), and the row is excluded.
Example:(C1:C10 > 80) * (D1:D10 = "Pass")means "show rows where the value in column C is greater than 80 AND the value in column D is 'Pass'." -
OR Logic (Addition
+): When you add two or more conditions, it's treated as an "OR" operation. This means that at least one of the conditions must be true for a row to be included. If any of the conditions result in a "TRUE" (a value greater than 0) the result of the addition will be greater than zero, and therefore the row will be included.
Example:(C1:C10 > 80) + (D1:D10 = "Pass")means "show rows where the value in column C is greater than 80 OR the value in column D is 'Pass'.
Important Considerations:
- Conditions: Conditions can use various operators like >, <, =, <>, >=, <=. You can also use text comparisons (e.g., `= "Maths"`).
- Multiple Conditions: Use commas to separate multiple conditions. All conditions must be true for a row to be included.
- Array Formulas:
FILTERis an array formula, meaning it can return a range of cells. It automatically spills into adjacent cells as needed. This means the results of theFILTERformula will automatically fill the cells below and to the right of the cell where you enter the formula. If you have data in the cells where the filter is trying to display its results, you will get an error. - Blank Cells:
FILTERwill ignore blank rows in the `range`. - No Matching Data: If no rows match the criteria,
FILTERwill return a `#CALC!` error. You can wrap the `FILTER` in an `IFERROR` to handle this. For example:=IFERROR(FILTER(A1:D10, C1:C10 > 80), "No matching data")
Ways you might want to use this:
Filtering Pupil Data by Grade LevelA teacher wants to see only the data for pupils in a specific stage (e.g., S3). They use |
Finding Pupils Who Scored Above a Certain MarkA teacher wants to identify pupils who scored above a certain mark on an assessment. They use
|
Filtering for Pupils in a Specific ClassA teacher with multiple classes wants to view data for only one class. They use |
Combining Multiple CriteriaA teacher wants to find pupils in S2 who scored above 80 on a particular test. They use |
Creating a List of Pupils Needing Additional SupportA teacher wants to create a list of pupils who are struggling in a particular subject. They use |
Generating a Report for Specific CriteriaA teacher needs to create a report showing data for a specific group of pupils (e.g., those receiving additional support). They use |
Analyzing Data by GenderA teacher might want to compare performance between male and female pupils. They can use |
Tracking Progress Over TimeA teacher could use |
You may want to watch this tutorial