Students sort a table by one column and filter it to the rows that match a rule, learning that sorting moves whole rows, filtering only hides, and both work on the whole table. They answer questions about eight animals from Year 7 classification, and repeat it in the spreadsheet app the school uses.
Open these in Waypoints Prepare with one click. To share a file another way, copy its address and paste it into Load URL, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
WorksheetOpen in PrintDownload Print the student copy; the Teacher edition has the answers.
Students will be able to
I can sort a table by one column, low to high or high to low.
I can filter a table to the rows that match a rule.
I can say what happens to the rows that do not match, and why a whole table is selected.
Timing
Predict and Try 10 min · Worked example 10 min · Vary 7 min · Practise 10 min · Make and own app 8 min
Before class
Do the Try board yourself: sort by D, high to low, then read across a row.
The one idea: sorting reorders whole rows by one column; filtering hides the rows that do not match. Neither changes the data. Students do not need the Data menu names yet.
The sheet on the page always sorts the whole table below its heading row, as a real app does when the whole table is selected. The mistake in Sam's story is what happens in a real app when only one column is selected.
Filtering here is 'show rows where a column is, is not, is more than or is less than a value'. In Excel and Sheets, filters are drop-down menus on the heading row; the idea is the same.
Be careful with sorting a table that has formulas in it: a formula that uses another row (such as =B3-B2) can give a different answer after a sort. The sheet moves a formula with its row, so a formula that uses its own row keeps working. That is worth saying out loud in a real app.
Running the lesson
Predict: students who chose Elephant think 'longest' means 'biggest'. Ask which column was sorted.
Try: ask what the Tortoise's group and mass are after the sort.
Worked example: ask what Sam would see if only the lifespans moved, and why that is worse than a mistake you can see.
Practise: ask how many rows are shown, and where the others went.
Own app: walk round. Common slips: only one column selected, and a header row sorted into the data.
In class
On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.
Think, pair, share(start) A student wants to know which bird lives longest. Should they sort first or filter first? Does the order matter?
What does each step show on its own?
What would the table look like after doing them in the other order?
For this question the order does not change the result, because a filter hides rows and a sort orders whatever is there. It matters for readability: filter first so there are fewer rows to read.
Order yourselves(predict, 3 min)
Ask five students to hold up a card with their own birthday month number. Sort them from low to high without separating anyone from their card.
The cards move with the students, as whole rows do. That is the point of sorting by one column.
A question for the data(make, 4 min)
What other questions could the animal table answer with a sort or a filter? Which would need both?
Examples: the lightest reptile, the longest-lived mammal, the animals over 10 kg.
Sort or filter?(investigate) You want to see only the animals that live more than 20 years. Which do you use? Filter A filter hides the rows that do not match the rule. A sort would only change the order.
The hard part (on purpose)
Believing a sort only moves the column you clicked in. In real apps, selecting just one column can sort only that column. Let students read across a row after a sort to check the row still makes sense.
When students get stuck
What you will see
A question to ask
The fix
A student sorts only one column (Sam's mistake) and the rows no longer make sense.
Read across one row. Does it still describe one animal?
Undo, then select the whole table, headings included, and sort again.
A student sorts by the wrong column.
Which column holds the thing you are ordering by?
Choose that column in 'Sort by'.
A student thinks filtering deleted rows.
What does the note 'Showing 2 of 8 rows' tell you?
Choose Show all. The rows come back.
A student's filter shows no rows.
Does the word you typed match the cells, including spelling?
Check the spelling, or choose a number rule such as is more than.
Answers to the checks
who comes first?: You sort the whole table by the Lifespan column, from high to low. Which animal is in row 2, just under the headings? Tortoise. It has the longest lifespan, 80 years, so high to low puts its row first. The whole row moves, so the Tortoise keeps its own group and mass.
Try: sort the table: Sort the table so the animal that lives longest is at the top.
The Tortoise (80 years) is now in row 2. The whole row moved together, so it still has its own group and mass.
Sort and filter: What does sorting the table by Lifespan do to the rows? Moves whole rows so each animal keeps its own numbers Sorting reorders whole rows by one column. Each row keeps its own cells.
Find the mistake: After Sam's sort, the Tortoise shows a lifespan of 2 years. Click the line where Sam first goes wrong. line 2 Line 2: Sam selected only the lifespan numbers. Only that column was sorted, so the animals stayed where they were and each got a different lifespan. Sorting needs the whole table selected.
Hidden, not deleted: You filter the table to show only the Birds. What has happened to the other rows? They are hidden, not deleted A filter hides the rows that do not match. The data is all still there, and Show all brings every row back.
Heaviest first: You want the heaviest animal first. Which sort do you choose? By Mass (kg), high to low High to low on the Mass column puts the biggest mass in row 2.
Longer than 20: The lifespans are 2, 25, 10, 15, 8, 80, 60 and 20. You filter to show only the animals whose Lifespan is more than 20. How many rows are shown? 3 The lifespans more than 20 are 25, 80 and 60, so three rows are shown.
Filter, then sort: You filter to show only the Mammals, then sort by Mass from high to low. Which animal is at the top of the rows you can see? Elephant Only the mammals are shown (Mouse, Cat and Elephant). High to low on Mass puts the Elephant first.
Where are the rows?: You filter to show only Birds and the sheet says Showing 2 of 8 rows. Where are the other six rows? Still in the sheet, hidden Filtering only hides rows. Choose Show all and all eight are back.
Lightest first: Sort the table so the lightest animal is at the top.
The Mouse (0.02 kg) is in row 2. Low to high on the Mass column puts the smallest first.
Only the mammals: Show only the mammals.
Three rows are shown: the Mouse, the Cat and the Elephant. The other five rows are hidden, not deleted.
Mammals, heaviest first: Show only the mammals, with the heaviest at the top.
The filter shows the three mammals, and the sort puts the Elephant (5000 kg) first.
answer a question: Which bird lives longest? Show only the birds, with the longest-lived at the top.
The two birds are shown with the Eagle (25 years) above the Penguin (20 years). A filter and a sort together answered the question.
Solutions
One possible solution for each task. Other correct programs are fine.
answer a question
Open task: any program that does what the step asks.
Stretch and support
Stretch: How would you find the three heaviest birds if there were many more rows? Which tool do you use first, sort or filter, and does the order matter?
Support: A card: Sort reorders whole rows by one column. Filter hides the rows that do not match. Select the whole table first.
Exit ticket
You sort the animals by Mass from low to high. Which animal is in row 2? And if you then filter to Birds, how many rows can you see?
The Mouse (0.02 kg) is in row 2 after the sort. Filtering to Birds shows 2 rows, the Eagle and the Penguin.
What each step is for
who comes first?: Committing to which row comes first tests the move: sorting orders whole rows by one column.
Try: sort the table: Sorting by Lifespan and reading the rows settles the prediction and shows whole rows moving together.
Worked example: sort, then filter: Selecting the whole table to sort models the move. Sam sorts one column on its own, the mistake planted after the method.
Vary: change the question: Each task changes the column, the rule or the order, then combines a filter with a sort.
ask the table: Using sort, then filter, then both together to answer a question about the table.
answer a question: Using a filter and a sort together to answer a question the student reads off the table is the move on their own question.
In your own spreadsheet app: Sorting and filtering in Excel or Sheets shows the same two moves in the real tool.
Where it leads
Next in Working with data: Choose a chart (column, line, scatter and pie).
Science: classification (Year 7). Data check: lifespans and masses are rough figures for teaching. Use your own class data if you have it.