AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Right data and quick finds

Week 17 · Unit 7: Be a data engineer · 3 lessons
3

Filter to find it

Computing 5: Unit 7, pp. 86–103
GoalUse a filter to show only the rows that match a criterion, for numbers and for text.
New words
filter · to show only the rows that match, and hide the restcriterion · the rule that a row must match to be shownmatch · to fit the criterionhidden row · a row that is not shown, but is still in the sheet
Explanation

A filter shows only the rows that match what we are looking for. The rows that do not match are hidden and not deleted. The rule we choose is the criterion. To filter, select the table, turn on the filter and use the arrow at the top of a column. For numbers, we can choose ‘less than’, ‘greater than’ or ‘equal to’. For text, we can tick items in the list or type a key word. To see all the rows again, clear the filter. Sorting and filtering are different: sorting puts rows in order, and filtering hides rows.

ABCD
1PlantTypePriceIn stock
2basilherb320
3mintherb415
4roseflower128
5tulipflower630
6appletree255
7lavenderflower512
8thymeherb325
Worked examples
RowPlantTypePriceIn stock
2basilherb320
3mintherb415
7lavenderflower512
8thymeherb325
Criterion: Price less than 6. Rows 2, 3, 7 and 8 match. The other rows are hidden. Notice that the row numbers jump.
RowPlantTypePriceIn stock
4roseflower128
5tulipflower630
7lavenderflower512
Criterion: Type equals flower. We tick only ‘flower’ in the Type column. Three rows match.
SortFilter
puts all the rows in ordershows only the rows that match
no row is hiddenother rows are hidden
use it to see largest or smallestuse it to find the rows you need
Sorting and filtering do different jobs.
Class activity

Hide and find (groups of 3). Make 8 strips of paper, each with one animal: name, number of legs, home and mass, for example ‘frog, 4 legs, pond, 0.05 kg’. Line them up like rows of a table. Choose a criterion, for example ‘legs equal to 4’, and fold back every strip that does not match. How many rows are left? Unfold them all (clear the filter) and try ‘mass greater than 10’. Does the data change when you filter?

Practice
1
Use the bike table. Which bikes are shown for each criterion? (a) Price less than 300, (b) Type equals mountain, (c) Gears greater than 20.
BikeTypePriceGears
Swiftroad35018
Trailmountain42021
Pipkids1201
Dashroad28014
Rockmountain38024
Minikids901
Glideroad45021
2
Put these steps in order: (a) choose a criterion, (b) select the table, (c) read the matching rows, (d) click the arrow at the top of the column, (e) turn on the filter.
3
A filter on the bike table shows only these rows. Which criterion was used?
RowBikeTypePriceGears
3Trailmountain42021
6Rockmountain38024
4
Does a filter delete the rows that do not match? How do you see them again?