Today, we will look at the different ways to sort numerically in Google Sheets. We will be using both in-application options and functions to achieve our goal.
Let’s get started.
First Things First: Determine if the Value is a Number
When sorting by any value, it is important to make sure that the set of data that you are sorting is of the same type. Otherwise, this might happen:
Here, we have two types of data: text and numbers. Sorting the whole set in Google Sheets organizes the data according to their type. So it is best to check beforehand to make sure all the data in your selection is of the same type, in this case, numbers.
We can determine this in two ways:
I. Check Value Alignment
When data is input in a cell in Google Sheets, it aligns itself in the cell according to its type by default.
- Left-aligned for text
- Right-aligned for numbers
Simply convert the text value to numbers before sorting.
II. Use ISNUMBER Function
Not all values in a worksheet will be aligned by default. Someone might have reorganized it. For such cases, we have a handy function available to us called ISNUMBER.
It simply determines whether the cell reference is a numerical value or not.
Later in this article, we will also see how to work with numbers as text values.
3 Ways to Sort Numerically in Google Sheets
1. Using Sort Range to Sort Numerically in Google Sheets
Let’s start with the simplest method, that is by using the Sort Range option of Google Sheets.
To use it, simply select the range of cells in the column you want to be sorted and navigate to the option. You can find the Sort Range options from the Data Tab > Sort Range
Here, we will find two basic options:
- Sort by Column B (A-Z): Ascending Order
- Sort by Column B (Z-A): Descending Order
We have selected the first option. Our result:
An advanced options menu is also available for Sort Range where we can apply or add a couple more conditions to the sort.
To open this window, we have to navigate:
Data > Sort Range > Advanced range sorting options
- Data has header row: If your selection includes the header cell/row, make sure to check this option, otherwise, the header will also be included in the sorting. Another reason to check this option is to make sure your header appears as a selectable option for the Sort by section.
- Sort by: Here we select the column/header on which we will base our sort condition. We also select the ascending or descending order from here.
- Add another sort column: If your dataset contains more than one column (which is usual) you can add more column conditions by clicking on this button.
You can also access this window by right-clicking over your selection.
Right-Click > View more cell actions > Sort Range
2. Using Filter to Sort Numerically in Google Sheets
While not a straight-up sorting method, the Filter option of Google Sheets can be used to sort columns in Google sheets.
The steps to us Filter to sort numerically in Google Sheets:
Step 1: Select the range of data. Make sure to select the column header. The header is the core of our filter. If you don’t have a header above your data, make sure to add one.
Step 2: Navigate to the Data tab to find the Create a filter option. Data > Create a filter
The header should now have a Filter icon beside it.
Step 3: Clicking on the Filter icon, you will be presented with a bunch of options. The ones we are looking for are the Sort options.
Step 4: Click on the Sort option you want to get the result.
3. Using Formulas to Sort Numerically in Google Sheets
Other than built-in options, we have the SORT function in Google Sheets to help us sort numerical data.
There are two advantages of using the SORT function:
- The sorted data is extracted to a different cell. It can be used to extract data from multiple locations, including another worksheet.
- Like advanced Sort Range, you can add multiple columns as sorting conditions.
The application is simple, you simply put the range of data within the SORT function, and the data will come out sorted in ascending order.
However, if you want a descending order for your sort, you have to add the following conditions to the SORT function:
- The 1 represents the first column of our selection which will be the primary sorting column condition.
- FALSE represents the sorting order. By default, it is TRUE (or 1) for ascending order. You can set it to FALSE (or 0) for descending order.
A Workaround: Sorting Text Values as Numbers
At the beginning of this article, we had discussed that we can’t get a proper sorting result if we had different types of values in our selection, like numbers and text.
The simplest workaround to this is to use a function that takes a text value and converts it to its numerical counterpart. This function is called VALUE.
Now, if we put this function in our SORT formula, we can get the proper result:
With that, we have formally covered how we can sort numerically in Google Sheets. We hope that the methods we have discussed come in handy in your daily tasks.
Feel free to leave any queries or advice you might have for us in the comments section below.