How to sort cells by last character or number in Excel?

It is easy to sort cells by the first character in Excel. But when you need to sort cells by the last character or number in Excel, how could you do it? This article is going to show you some easy ways to sort cells by last character or number in Excel quickly.

Recommended Productivity Software

Office Tab: Use tabbed interface in Office as the use of web browser Chrome, Firefox and Internet Explorer.
Kutools for Excel: Adds 120 powerful new features to Excel. Increase your productivity in 5 minutes. Save two hours every day!
Classic Menu for Office: Brings back your familiar menus to Office 2007, 2010 and 2013 (includes Office 365).

An example may be easy to understand. The following ways will show you how to sort the cells in the Column A by their last characters.

Hint

Sort by last character or number with Right Function

If we can extract the last characters from each cell, it will be easy to sort the cells by their last characters. Luckily, Microsoft Excel's Right function supports extracting the last letter or number form cells.

Step 1: Insert two columns before the Column A.

Step 2: In the Cell B1, enter the formula of =RIGHT(C1,1), and press the Enter key.

Step 3: Select and highlight the Column B, click the Home >> Fill >> Down to copy the Right formula to other cells.

Step 4: Copy the Column B, and Paste special with value into the Column A.

Step 5: Select and highlight the range of A1:C7.

Step 6: Click one of three Sort buttons under Data tab.

Step 7: Delete the Column A and Column B.

Then you will see the cells in original Column A are sorted by their last characters.

Sort by last character or number with VBA

You may also think of reverse the cell contents before sorting them by their last characters. Actually here is a VBA macro can help you.

Step 1: Hold down the Ctrl + F11 key to open the Microsoft Visual Basic for Application window.

Step 2: Click the Insert >> Module, and paste the following VBA code on the new Module window:

Public Function RevStr(Rng As Range)
RevStr = StrReverse(Rng.text)
End Function

Step 3: Go back to the Microsoft Excel window, enter the formula of =RevStr(A1), and press the Enter key.

Step 4: select the range of B1:B7, and click the Home >> Fill >> Down.

Step 5: Click one of three Sort buttons under the Data button.

Step 6: Please check the Expand the selection option and click the Sort button.

Step 7: Delete the Column B.

Now it sort all cells in the column a by their last characters.

Recommended Productivity Tools

The following tools will greatly save your time and effort, which one do you prefer?
Office Tab: Using handy tabs in your Office, as the way of Chrome, Firefox and New Internet Explorer.
Kutools for Excel: 120 powerful new functions for Excel, Increase your productivity in 5 minutes. Save two hours every day!
Classic Menu for Office: Bring back familiar menus to Office 2007, 2010, 2013 and 365, as if it were Office 2000 and 2003.

Kutools for Excel

Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

More than 120 powerful advanced functions which designed for Excel:

• Merge Cell/Rows/Columns without Losing Data.
• Combine and Consolidate Multiple Sheets and Workbooks.
• Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
• Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,