GoalSort a table by one column and keep each row together.
New words
column · a line of cells going down; it holds one fieldrow · a line of cells going across; it holds one recordsort by · to put the rows in order using the data in one column
Explanation
A table has rows and columns. Each row is a record: all the facts about one thing. When we sort a table, we choose one column to sort by. The rows move so that this column is in order, but each row stays together. If only one column moved, the names would be joined to the wrong ages! So we always select the whole table, including the headings, before we sort. The chosen column can be sorted in ascending or in descending order. Sorting can answer questions such as “Who is the youngest?” or “Which book has the most pages?”
A
B
1
Name
Age
2
Ana
7
3
Leo
9
4
Omar
10
5
Yuki
8
6
Ben
6
Worked examples
A
B
1
Name
Age
2
Ben
6
3
Ana
7
4
Yuki
8
5
Leo
9
6
Omar
10
Here is the table sorted by Age in ascending order. Ben is the youngest and is at the top. Omar is the oldest and is at the bottom. Each name moved with its age.
A
B
1
Name
Age
2
Yuki
8
3
Omar
10
4
Leo
9
5
Ben
6
6
Ana
7
Now the same table is sorted by Name from Z to A (descending). The names come in the order Yuki, Omar, Leo, Ben, Ana, and every age moved with its name.
A
B
1
Name
Age
2
Ana
6
3
Leo
7
4
Omar
8
5
Yuki
9
6
Ben
10
A mistake: someone sorted only the Age column. The names stayed where they were, so the table now says that Ana is 6, but Ana is really 7. This is why the whole table must be selected.
Class activity
Card table (with a friend): write five book cards, each with a title and a number of pages: Kite Day 96, Sea Stories 120, Big Map Book 200, Tiny Ants 32, Moon Trip 64. Sort the cards by pages in ascending order and write the titles down. Now sort the cards by title from A to Z and write them down again. Which book is the longest? Which comes first in the A to Z list?
Practice
1
Write the rows in ascending order by Price.
A
B
1
Toy
Price
2
Top
4
3
Kite
6
4
Drum
9
5
Ball
3
Ball 3, Top 4, Kite 6, Drum 9.
2
Write the same rows sorted by Toy from A to Z.
Ball, Drum, Kite, Top, with their prices 3, 9, 6, 4.
3
Why must we select the headings and all the columns before sorting?
So that each row moves as one record. If not, names and numbers get mixed up.
4
Which column is this table sorted by, and in which order?
A
B
1
Player
Score
2
Yuki
9
3
Ana
8
4
Leo
6
By Score, in descending order. The names are not in order.