Sorting puts the rows of a table in order by one column, and moves whole rows so every row keeps its own numbers. Filtering hides the rows that do not match a rule, without deleting them, so you can look at just the ones you want. Both work on the whole table, headings included, and neither changes the data itself.
A table lists eight animals in the order someone wrote them down. Which lives longest? Which are birds? You could read the whole table, or you could ask the sheet.
This table of animals is in the order it was typed in, not in any helpful order. Mass is in kg and lifespan is a rough figure in years. Below the table are controls to sort it and to filter it.
A
B
C
D
1
Animal
Group
Mass (kg)
Lifespan (years)
2
Mouse
Mammal
0.02
2
3
Eagle
Bird
5
25
4
Goldfish
Fish
0.1
10
…
…
…
…
…
How this lesson works: Predict, Try, Investigate, Modify, Practise, Make
Predict: Read the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
Try: Try it on the board and compare the result with your prediction.
Investigate: Work out why it happens, one step at a time.
Modify: Change the problem on purpose and see what happens.
Practise: A few on your own, to check you have it.
Make: Make your own problem using what you have learned. Expect a few tries; that is normal.
Extra examplesYour teacher may tell you which.
Make your prediction first. Help opens once you've locked it in.
PredictRead the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
Who comes first?
TryTry it on the board and compare the result with your prediction.
Try: sort the table
Was your guess right? Read across the Tortoise's row: it still says Reptile and 50 kg. Sorting moved the whole row, not just the lifespans.
Try it yourselfYour edits are saved in this browser.
Filter the Group column for Bird. Then sort by Lifespan from high to low. Read the top row.
Another hint
Two birds are shown, so the one at the top lives longest.
Which bird lives longest? Show only the birds, with the longest-lived at the top.
Use the board. This ticks when you get there.
Make Extra · typicalMake your own problem using what you have learned. Expect a few tries; that is normal.
In your own spreadsheet app
Excel, Google Sheets and Numbers all sort and filter. Select the whole table, headings included, and find Sort and Filter under the Data menu. If the headings end up sorted with the data, tick the option that says your data has a header row. Hidden rows are not deleted: clear the filter to see them again.
Lesson done. You've finished every step you need.
Now you can
Sort a table by one column, low to high or high to low.
Filter a table to the rows that match a rule.
Say what happens to the rows that do not match, and why a whole table is selected.
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. About 45 minutes.
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.
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.
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
A student sorts only one column (Sam's mistake) and the rows no longer make sense. Ask: Read across one row. Does it still describe one animal? Fix: Undo, then select the whole table, headings included, and sort again.
A student sorts by the wrong column. Ask: Which column holds the thing you are ordering by? Fix: Choose that column in 'Sort by'.
A student thinks filtering deleted rows. Ask: What does the note 'Showing 2 of 8 rows' tell you? Fix: Choose Show all. The rows come back.
A student's filter shows no rows. Ask: Does the word you typed match the cells, including spelling? Fix: Check the spelling, or choose a number rule such as is more than.
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.
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.
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.