Sorting and transposing tables

Rows (or columns) in a table can be sorted in ascending or descending order according to the data in up to three columns (or rows). Cell data can be evaluated as numbers or as strings of characters. See the examples below.

Name Age
Joe Smith 26
Joe Smith 17
Alan Alcove 51
Christy Maer 9
Helen Haunt 101

Original

Name Age
Alan Alcove 51
Christy Maer 9
Helen Haunt 101
Joe Smith 26
Joe Smith 17
Name Age
Alan Alcove 51
Christy Maer 9
Helen Haunt 101
Joe Smith 17
Joe Smith 26

Sorted by column 1

Sorted by column 1
then by column 2

Name Age
Christy Maer 9
Joe Smith 17
Joe Smith 26
Alan Alcove 51
Helen Haunt 101
Name Age
Helen Haunt 101
Joe Smith 17
Joe Smith 26
Alan Alcove 51
Christy Maer 9

Sorted by column 2
as number

Sorted by column 2
as string

A table can also be transposed, swapping rows for columns and vice versa as in the following example:

Color Sign
John Green Gemini
Mary Taupe Aries
John Mary
Color Green Taupe
Sign Gemini Aries

Original

Transposed

To sort a table or part of a table
  1. Place the insertion point in the table to be sorted or select the cells to be sorted.
  2. On the Layout menu, go to Convert and Calculate, and then click Sort.
  3. If you want to sort columns, click Sort left to right under Options. To sort rows, leave the option deselected.
  4. Under Sort by, select the column (or row) according to which the rows (or columns) will be sorted; specify whether to evaluate the cell contents as strings or as numbers; and specify whether to order the rows (or columns) in ascending or descending order.
  5. (optional) If the column (or row) you selected under Sort by contains some cells that have the same contents, select another column (or row) as the second sort criterion under then by and specify its sort options. You can also specify a third column (or row) to sort by.
  6. Under Options, select the desired options:
    • To sort only selected cells, select Sort selected cells only.
    • To rearrange only the contents of cells without affecting the cells’ properties, such as alignment and background color, select Sort contents only.
    • To exclude the first or last row in the table or selection from being sorted, select Exclude the first selected row or Exclude the last selected row.
  7. Click OK.

Namo Web Editor icon note Sorting and transposing tablesYou cannot sort a table that contains any merged cells.

To transpose a table
  1. Place the insertion point in the table to be transposed.
  2. On the Layout menu, go to Convert and Calculate, and then click Transpose Table.
Related topics

Sort Table dialog box

Sorting and transposing tables