Sort by Row in Google Sheets (2 Basic Ways)

There are no definite or built-in ways to sort by row in Google Sheets. All we can do is look for workarounds to sort this unique arrangement of data, a couple of which we will discuss in this article.

Let’s get started.


The Relevance of Horizontal Column Sorting (Sort by Row)

Data in any spreadsheet may not always be organized in the classic table format. We may sometimes see our data arranged in columns (horizontally).

This is because it is easier to lookup data this way. Since the easier to find the data is, the better we can work with it.

Now, sorting this horizontal data becomes even more important as we can get different outcomes when we apply functions like MATCH and HLOOKUP.


2 Ways to Sort by Row in Google Sheets

1. Using SORT and TRANSPOSE Functions

The first, and perhaps the only, way to sort by row in Google SHeets is to use a combination of the SORT and TRANSPOSE functions.

For this scenario, we have created the following worksheet:

horizontally arranged table for sort by row in google sheets

As we all know, the SORT function only understands data in the traditional vertical column form. So, to make the function recognize the horizontal arrangement, we take the help of the TRANSPOSE function for the data_range field of the SORT function. The rest of the formula remains as it is.

To sort in the ascending order of the ID, our formula is:

=SORT(TRANSPOSE(C2:G3),1,TRUE)

using transpose as data range for sort function

Another thing to note is that in the horizontal form the column index starts from the top, where traditionally it started from the left.

As you can see, the result of the sort is presented in the classic vertical column format, again since the SORT function was made to work only in this format.

To keep the horizontal arrangement of the table, we have to use another TRANSPOSE function, this time, enclosing the SORT function itself.

=TRANSPOSE(SORT(TRANSPOSE(C2:G3),1,TRUE))

sort by row in google sheets using sort and transpose functions


2. Manually Copy-Pasting the Data Transposed (The Longer Method)

The method discussed in the previous section can be performed in a completely basic way. While it does involve a couple of extra steps and gives more freedom to utilize Google Sheets’ built-in options, it can be considered only for very rare occasions. You will see what I mean as we go through the steps.

Step 1: Copy and Paste Transposed.

Select the whole table to copy it and paste it in the desired spot transposed. You can find the Transposed option under Paste Special after you right-click over a cell.

the transposed option under paste special

Our transposed copy-paste result:

result of transposed copy-paste

Step 2: Sort the newly pasted table with any default method.

Google Sheets has multiple built-in options that can be used to sort a regular table. The one that we are going to use is the Sort Range option.

We can open the Sort range options window by right-clicking over the selection and navigating to it.

Right-Click > View more cell actions > Sort range

navigating to sort range options window

Step 3: Choose your desired sorting conditions.

In the Sort range options window, you get to choose your sorting options. We have chosen the following:

the sort options that we have chosen

Our result:

the transposed table is sorted

Step 4: Copy and Paste the sorted table transposed.

We copy the newly sorted table and paste it once again using the Paste Special > Transposed option.

sort by row in google sheets manually


Final Words

That should cover the fundamentals and the importance of how to sort by row in Google Sheets. Please feel free to leave any queries or advice you might have for us in the comments section below.


Related Articles for Reading

Mehrab Imtiaz

Mehrab Imtiaz

Mehrab Imtiaz is a Technical Writer for officewheel.com specializing in everything Google Sheets. Mehrab has always had a profound passion for writing and with his experience with MS Excel and Google Sheets throughout his career, it seems to be a great match when it comes to dishing out tips and tutorials for all to enjoy.

We will be happy to hear your thoughts

Leave a reply

OfficeWheel
Logo