How to Sort in Excel by Number of Characters (2 Methods)

If you want to sort in Excel by numbers only, you can do so directly using some Excel commands. But in case you are looking for ways to sort by the number of characters, then you have to use additional formulas to do that. In this article, you will learn 2 different methods to sort in Excel by the number of characters.


How to Sort in Excel by Number of Characters (2 Easy Methods)


1. Sort in Excel by Number of Characters with LEN Function and a Helper Column

The most common way of sorting data in Excel by the number of characters is to LEN function and a Helper column. Then based on the data of the Helper column, you will be able to sort by the number of characters in Excel.

Now let’s see the whole procedure step by step.

❶ First of all, create a Helper column left to the main data table.

❷ Then insert the following formula in the top cell of the Helper column.

=LEN(C5)

Sort in Excel by Number of Characters with LEN Function

The LEN function returns the number of characters of a selected cell value. Here, I selected cell C5 so it will return the number of characters of the value “Tom Duff”.

❸ Then hit the ENTER button.

Sort in Excel by Number of Characters with a Helper Column

❹ After that keep your mouse cursor at the right-bottom corner of the cell where you’ve entered the formula.

The Fill Handle icon will appear.

❺ Now pull down that icon (+)  throughout the rest of the cells to AutoFill the formula.

❻ Now select the Entire Helper column and go to Data > Sort & Filter > Sort.

Sort in Excel by Number of Characters

After hitting the Sort button, the Sort Warning dialog will appear.

❼ Make sure the Expand the selection command is selected and then hit the Sort button.

After that, the Sort dialog box will appear.

❽ Select the Helper column in the Column Sort by drop-down.

❾ Then select Smallest to Largest from the Order drop-down.

❿ Finally hit the OK button to apply the changes.

Now you will see your data have been sorted by the number of characters as in the picture below:

Read More: How to Put Numbers in Numerical Order in Excel


2. Use SORTBY Function to Sort in Excel by Number of Characters

Microsoft Office 365 has come up with a new function called the SORTBY function. This function can Sort data based on the information that you put inside it.

If you are using an older version of Excel, you can not use this method.

Anyways, let’s get started.

❶ At first create an identical data table to your original data table without the contents.

❷ After that, insert the following formula in the very first cell of the blank data table.

=SORTBY(B5:C14,LEN(B5:B14),-1)

Use SORTBY Function to Sort in Excel by Number of Characters

❸ Finally hit the ENTER button to enter the formula above.

After that, you will have all the data sorted by the number of characters as in the picture below:

Formula Breakdown

  • LEN(B5:B14) calculates the length of the contents inside each of the cell addresses in the range.
  • -1 sorts data in descending To sort data in ascending order you have to use 1.
  • SORTBY(B5:C14,LEN(B5:B14),-1) sorts data in the range B5:C14 based on the numerical data from LEN(B5:B14) in descending order.

Read More: How to Sort by Name in Excel


Practice Section

You will get an Excel sheet like the following screenshot, at the end of the provided Excel file. Where you can practice all the methods discussed in this article.


Download Practice Workbook

You can download the Excel file from the following link and practice along with it.


Conclusion

To sum up, we have discussed 2 methods to sort in Excel by the number of characters. You are recommended to download the practice workbook attached along with this article and practice all the methods with that. And don’t hesitate to ask any questions in the comment section below. We will try to respond to all the relevant queries.


Related Articles


<< Go Back to Sort in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mrinmoy Roy
Mrinmoy Roy

Mrinmoy Roy, a dedicated professional with a BSc in Electronics and Communication Engineering from Khulna University of Engineering & Technology, Bangladesh, brings over two years of expertise to the ExcelDemy project. As a prolific contributor, he has authored around 180 articles, showcasing his deep knowledge and passion for Microsoft Excel, Data Analysis, and VBA. His unwavering commitment to continuous learning, combined with versatile skills, renders him well-suited for roles in data management and spreadsheet solutions. He has interest... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo