---
title: "Put the rows in order"
subtitle: "Working with data · Show the data · Lesson 7"
---

# Put the rows in order

**Name:** {{field-24}} **Date:** {{field-15}} **Class:** {{field-15}}

> **Key question:** 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.


:::teacher-note

**In one sentence:** 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.

**Students should be able to say:** 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.

**Width:** the unmarked parts are the floor every student does (predict, run, investigate and make). Typical adds the modify practice; wider adds the real-world contexts. They add contexts, not difficulty. Students work in the online tutorial alongside this sheet.

:::


## Predict


:::keep-together

**You sort the whole table by the Lifespan column, from high to low. Which animal is in row 2, just under the headings?**

☐ Tortoise

☐ Eagle

☐ Elephant

☐ Mouse

My prediction, and why:

{{lines-3}}

:::


:::teacher-note

**What happens:** 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.

:::


## Run

Try it on the board in the tutorial. Was your prediction right? What was different?

{{lines-2}}

## Worked example: sort, then filter


:::keep-together

### Sort and filter

1. $\text{Sort by Lifespan, high to low}$ — The sheet puts the rows in order of the lifespan column, biggest first.
2. $\text{Tortoise: Reptile, 50, 80} \text{ moves to row 2}$ — The whole row moves, so each animal keeps its own numbers.
3. $\text{Filter: Group is Bird}$ — The sheet hides every row that does not match.
4. $\text{Showing 2 of 8 rows}$ — Eagle and Penguin are shown. The other six are only hidden.
5. $\text{Show all}$ — The hidden rows come back. Nothing was lost.

Now: what happens to the rows?

**What does sorting the table by Lifespan do to the rows?**

☐ Changes the lifespans to be in order

☐ Deletes the rows that are out of order

☐ Moves whole rows so each animal keeps its own numbers

☐ Moves only the lifespans

:::


:::teacher-note

**Answer:** Moves whole rows so each animal keeps its own numbers

Sorting reorders whole rows by one column. Each row keeps its own cells.

:::


:::keep-together

### Find the mistake

**After Sam's sort, the Tortoise shows a lifespan of 2 years. Click the line where Sam first goes wrong.**

```
 1  Sam's table has the animals in column A, their groups in B, their masses in C and their lifespans in D.
 2  Sam selects only the lifespan numbers, D2 to D9.
 3  Sam sorts the selection from high to low.
 4  The Tortoise's row now says Reptile, 50 kg and 2 years.
```

Line: {{field-15}}

Why is it wrong?

{{lines-2}}

:::


:::teacher-note

**Answer:** 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.

:::


:::keep-together

### Hidden, not deleted

**You filter the table to show only the Birds. What has happened to the other rows?**

☐ They move to the bottom

☐ They are deleted

☐ Their cells are cleared

☐ They are hidden, not deleted

:::


:::teacher-note

**Answer:** 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.

:::


:::typical

## Vary: change the question


**Heaviest first.** 

**Longer than 20.** 

**Filter, then sort.** 

Work in the tutorial. Plan first: what will you change, and how will you test it?

{{box-4}}

:::


## Ask the table


:::keep-together

### 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?**

☐ Deleted

☐ Copied into a new sheet

☐ Moved to the bottom

☐ Still in the sheet, hidden

:::


:::teacher-note

**Answer:** Still in the sheet, hidden

Filtering only hides rows. Choose Show all and all eight are back.

:::


## Make: answer a question

Which bird is at the top? Write down the answer in your own words, and say which two steps found it.

Work in the tutorial. Plan first: what will you change, and how will you test it?

{{box-4}}


:::typical

## Make: 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.

Work in the tutorial. Plan first: what will you change, and how will you test it?

{{box-4}}

:::


## Exit ticket

:::keep-together

**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?**

{{lines-3}}

:::


:::teacher-note

**Answer:** The Mouse (0.02 kg) is in row 2 after the sort. Filtering to Birds shows 2 rows, the Eagle and the Penguin.

:::

