⬇ Download PDF

Unit 2 · Topic 06 · Data Analysis and Representation (Google Sheets)

Sorting the Table

Hook

One click, and Kabir became the top scorer of the match.

He had not touched a bat.

Anaya stared at the screen. "That is… not what happened."

The Story

Class 4 had played a cricket match at lunch. Anaya put the scores into Google Sheets: five players in column A, their runs in column B. Meera 18, Anaya 24, Rohan 45, Sara 12, Kabir 31.

"Let's put the best score on top," she said.

She clicked the letter B to select just the runs column, then sorted it largest to smallest. The runs slid into a neat line: 45, 31, 24, 18, 12.

The names did not move at all.

Now the sheet said Meera had scored 45. Anaya had 31. Rohan, who really hit 45, was shown with 24.

"Wait, should we…" Kabir began, then stopped. "It says I scored 12. I scored 31."

Pixel's fan groaned like an old uncle standing up.

Anaya pressed Ctrl and Z. Everything snapped back.

Ms. Rao pulled up a chair. "A row is one player's whole story. Name and runs belong together. You sorted one column and left the other behind, so every row broke apart."

"So how do I do it properly?"

"Select the whole table first. All of it — names and runs."

Anaya dragged from A1 to B6. Then she opened the Data menu, chose Sort range, and clicked Advanced range sorting options. A small box appeared. She ticked Data has header row, so the word "Runs" would stay on top instead of being sorted like a score. She chose to sort by Runs, and picked Z to A for biggest first.

Click. Rohan 45. Kabir 31. Anaya 24. Meera 18. Sara 12.

Every name still had its own runs. Kabir checked his row twice, just to be sure.

Anaya's mistake shown on the real sheet: the Player names stay in their original order while only the Runs column is sorted, so all five players are paired with the wrong score. What Anaya actually did — she selected column B only #AB PlayerRuns 1 2Meera 3Anaya 4Rohan 5Sara 6Kabir 4531241812 was 18was 24was 45was 12was 31 Only the red column moved. The names stayed exactly where they were, so every row now pairs a player with somebody else's score. Fix: press Ctrl + Z at once, then select A1 to B6 and sort again.
Five rows, five wrong scores, and not one number deleted.

So What Just Happened?

Sorting puts rows in order. It never adds or deletes anything — it only rearranges.

The danger is selecting too little. If you select one column and sort it, only that column moves. The other columns stay put, the rows break apart, and the sheet quietly lies to you.

The safe way is to select the whole table, then use Data ▸ Sort range ▸ Advanced range sorting options. Tick "Data has header row" so your heading stays on top. Then pick the column to sort by, and choose A → Z, which is smallest first for numbers and alphabetical for words, or Z → A, which is largest first. If a sort goes wrong, press Ctrl + Z straight away and the old order comes back.

A before and after comparison showing that when the whole range is sorted by Runs from Z to A, each player's name travels with their own score, so Rohan and his 45 move up together. BEFORE — whole range A1:B6 selected AFTER — sorted by Runs, Z → A ✓ PlayerRuns Meera18 Anaya24 Rohan45 Sara12 Kabir31 Rohan 45 the whole row travels together Data ▸ Sort range ▸ Advanced range sorting options ☑ Data has header row PlayerRuns Rohan45 Kabir31 Anaya24 Meera18 Sara12 Same five names, same five scores, same five pairs — only the order changed.
Sorting a whole range moves complete rows, so no pair is ever broken.

Remember This

  • Sorting rearranges rows. It never deletes or changes a value.
  • Select the whole table before sorting, never one column alone.
  • Use Data ▸ Sort range ▸ Advanced range sorting options.
  • Tick "Data has header row" so your heading is not sorted like data.
  • A → Z is small first; Z → A is largest first. Ctrl + Z undoes a bad sort.
A five-step cheat card of the sorting menu path, followed by a do and don't pair about selecting the whole table before sorting. Sort cheat card — five steps, every time 1. Select theWHOLE table 2. Data ▸Sort range 3. Advanced rangesorting options 4. ☑ Data hasheader row 5. Pick column,A→Z or Z→A DO — select names AND numbers A → Z = 12, 18, 24, 31, 45 Z → A = 45, 31, 24, 18, 12 DON'T — select one column alone The rows break apart and every name gets the wrong number.
The menu path, the two directions, and the one mistake to avoid.

Try It Yourself

Make a two-column sheet: five family members in column A, their ages in column B.

Sort the whole table by age, Z → A, with the header row ticked. Then sort it again by name, A → Z.

After each sort, check that every person still has the right age beside their name.

Word Bank

Sort
To put rows in order using the values in one chosen column.
Range
The block of cells you have selected, such as A1 to B6.
Header row
The top row of column names; it should stay on top when sorting.
A → Z
Smallest number first, or words in alphabetical order.
Z → A
Largest number first, or words in reverse alphabetical order.

Questions

Loading questions…