This tutorial demonstrates how to sort by number in Excel and Google Sheets.
Sort by Number
Say you have the data shown below, an unsorted list of numbers in Column B. Let’s use this example to show how to sort by number.
To sort the numbers in ascending order, use the sort command in Excel. Select the column to sort, and in the Ribbon, go to Home > Sort & Filter > Sort Smallest to Largest.
Now Column B is sorted, with the numbers in ascending order.
Filter Then Sort by Number
You can also sort numbers by first applying a filter to the column.
- Click on any cell in the column you want to sort. In the Ribbon, go to Home > Sort & Filter > Filter.
- Click on the filter button, which has appeared in cell B1, and choose Sort Smallest to Largest.
The result is the same as using the sort command.
Possible Issues While Sorting
Excel’s sorting command works with both alphabetical and numerical data, but sometimes cell content can be misread and not accurately sorted. For example, if any number in your list is stored as text (because of bad formatting, leading spaces, or something else), that value will not be sorted correctly. Say the value in cell B6 has a leading space and you sort by Column B.
As you can see, this cell has a warning that the number is stored as text. Apart from this value, all other cells are sorted correctly.
To resolve this problem, click on the warning icon next to the cell, and choose Convert to Number.
Now, if you sort the data again, the value is sorted with the others.
Sort by Number in Google Sheets
Let’s use the example data from above to demonstrate sorting in Google Sheets. Select the range to sort (B2:B9) and in the Menu, go to Data > Sort range by column B, A → Z.
As in Excel, this sorts Column B from the smallest value to the largest.
Google Sheets has various column options. For this example specifically, column options in Google Sheets function like an Excel filter.
Position the mouse on a column letter and click on the arrow when it appears next to the letter. Then click on Sort sheet A → Z.
Again, as in the sections above, you get numbers in Column B sorted in ascending order.