How can I sort data by length in Google Sheets? Can you provide an example?

Google Sheets is a spreadsheet software that offers various tools to organize and manipulate data. One useful feature is the ability to sort data by length, which can help in analyzing and managing large datasets. To sort data by length in Google Sheets, you can use the “SORT” function and specify the range of cells you want to sort and the column to sort by. For example, if you have a list of names in column A and want to sort them by their length, you can use the formula “=SORT(A:A, LEN(A:A), TRUE)” which will sort the names in ascending order based on their length. This feature can be particularly helpful in tasks such as organizing names or titles by their character count.

Sort by Length in Google Sheets (With Example)


Often you may want to sort the strings in a column in Google Sheets based on character length.

Fortunately this is easy to do by using the LEN function.

The following step-by-step example shows exactly how to do so.

Step 1: Enter the Data

First, let’s enter the names of various basketball teams in Google Sheets:

Step 2: Calculate Length of Each String

Next, we will type the following formula into cell B2 to calculate the length of the string in cell A2:

=LEN(A2)

We can then click and drag this formula down to each remaining cell in column B:

The Length column displays the number of characters in each corresponding string in the Team column.

Step 3: Sort Strings by Length

Next, highlight the cell range A2:B11, then click the Data tab along the top ribbon, then click Sort range, then click Advanced range sorting options:

In the new window that appears, choose to Sort by Column B from A to Z, then click Sort:

Note #1: If you would rather sort from longest to shortest length, then click Sort by Z to A instead.

Note #2: Feel free to delete the Length column once you’ve used it to sort the data.

Additional Resources

The following tutorials explain how to perform other common operations in Google Sheets:

x