How to Sort Rows in Google Sheets [Best Practice]

how to sort rows in google sheets 4
Key Takeaways: How to Sort Rows in Google Sheets

To Sort Rows in Google Sheets

  1. Open your data set in Google Sheets.
  2. Click on a cell where you want the sorted data to appear.
  3. Enter the following formula: =TRANSPOSE((SORT(TRANSPOSE(B3:H3), 3, FALSE))) Press Enter, and your data will be sorted row-wise.

In this article, we will learn how to sort rows in google sheets.

Mostly we don’t sort rows, the general sorting is made according to columns data and not for rows, when you try to select a row and apply a normal sorting function on it, you will see it will be messed up. This is because the sort functionality is designed for columns only. But we have a manual method, or we can say a custom formula to sort our row or multiple rows accurately without messing it up. So today we will talk about that custom formula in this article, let’s go ahead,

If you have your data points in horizontal order and you want to sort them, then you can use the transpose function. Transpose function is nothing but a function that flip rows into columns, after transposing we will trigger a sorting function and then again, a transpose function to reset our rows. All these processes will work automatically in the background we just need to set up a transpose formula with the sort function to get our rows sorted accurately.

Let’s move to some basics and then we’ll move towards the practical procedure to learn how to sort rows in google sheets.

If you are interested to learn about how to sort pivot table in google sheets, please follow the link below.

How to Sort Pivot Table in Google Sheets (Best Practice)

Use Cases of Sort Rows in Google Sheets

Sorting data is very important either the data is small or large, sometimes we need sort function very frequently, so we may use auto sort, other times we are supposed to use various sorting functions to keep our data organized and arranged properly. We all have done a basic sort in our life, and it works on columns, really? can’t we sort horizontally? can’t we sort our rows? Unfortunately, we don’t have any built-in feature for sorting rows, because sorting is itself design for columns, so here we have a small trick to sort our rows accurately, a double transpose function with a sort function in between. It is very simple than it sounds like. We need to learn this function to sort our data horizontally in the form of rows without any tedious work.

  • To sort single or multiple rows
  • To sort data horizontally in any order

Download/Copy Practice Workbook

How to Sort Rows in Google Sheets

Step 1

Open any data set with google sheets.

how to sort rows in google sheets 1

Now we want to sort this data horizontally not vertically. That means, we need to perform sort by rows in this case in google sheets.

how to sort rows in google sheets 1.1

Step 2

Click any cell and start writing formula.

how to sort rows in google sheets 2

Step 3

Write down the Transpose and Sort formula completely.


how to sort rows in google sheets 3


how to sort rows in google sheets 3.1


how to sort rows in google sheets 3.2


how to sort rows in google sheets 3.3


how to sort rows in google sheets 3.4


TRANSPOSE function in Google Sheets

  • Transpose is the name of function
  • Inside transpose sort function will be executed
  • After sort we will repeat transpose to to reset to the original data
  • Data range
  • Row number
  • Is_acsending


Step 4

Hit Enter, and your data will be cloned with row-wise sorting.

how to sort rows in google sheets 4


How to Lock Rows in Google Sheets for Sorting

Locking rows when sorting is very easy method, you can freeze the rows or columns of your choice when sorting, so for this specific task – how to lock rows, we will select the row to be locked and then we will go to view in the main menu and then freeze, now we will select an option to lock the rows, if you want to select a header row then select any column in that row and then go to view and freeze and then freeze up to row 1. This is so simple.

how to sort rows in google sheets b


To recap, we learned how to sort rows in google sheets, it’s a very not one of the common features and many people have never used this feature and most of us have never realized that standard sorting functions are only implemented to columns, after this article you have learned many things, and of course the transpose and sort combination to sort rows accurately without any redundancy or duplications. Note that, you can set order in the formula true means ascending (A-Z) and false means descending (Z-A), row number is nothing but the number of the row you are sorting, and rest are self-explanatory.


  • Understand all the arguments of the function properly
  • Use true or false or ascending or descending order
  • Must mention row number. In example row number is 2
  • Never sort rows directly, it will mess up your data


In this article, we learned how to sort rows in google sheets, this is a comprehensive guide to completely learn about row sorting in google sheets, because row sorting is not straight forward, we need to understand some technical terms and then with the help of a custom formula we can get our rows sorted. I hope you find this article helpful. Please support us by sharing this article with your network.

Content Protection by

M. Shaiq Ansari

Hi, I am Shaiq, I am a highly skilled technical writer working full-time for Office Demy. I am specialized in Google Workspace and Microsoft Office applications. With a background in Software Engineering, I possess a deep understanding of the intricate functionalities and features of these productivity tools. Connect me on Linkedin
Enable registration in settings - general