Skip to main content

How to sort alphanumeric data starting with numbers in Excel?

Author: Xiaoyang Last Modified: 2024-11-21

If your data in Excel includes entries starting with numbers followed by optional text (e.g., "201510", "201510AA", "201520"), sorting them directly may not produce the order you want. Typically, Excel separates pure numbers and alphanumeric combinations, which can lead to an incorrect sequence. For example, "201510" might sort separately from "201510AA". This guide demonstrates how to sort such alphanumeric data while keeping numerical prefixes in the correct order, ensuring results like "201510", "201510AA", "201520".

Sort alphanumeric data with formula helper column

Original data   Normally sort result   your wanted sort result
Screenshot of the original alphanumeric data in Excel Arrow Screenshot of the normally sorted data in Excel Arrow Screenshot of the desired sorting result for alphanumeric data in Excel

arrow blue right bubble Sort alphanumeric data with formula helper column

In Excel, you can create a formula helper column, and then sort the data by this new column, please do as following steps:

1. Enter this formula =TEXT(A2, "###") into a blank cell besides your data, B2, for instance, see screenshot:

Screenshot of entering a helper column formula in Excel

2. Then drag the fill handle down to the cells that you want to apply this formula, see screenshot:

Screenshot of helper column formulas filled down in Excel

3. And then sort the data by this new column, select the helper column you created, then click Data > Sort, and in the popped out prompt box, select Expand the selection, see screenshots:

Screenshot of the Sort option selected from the Data tab in Excel Arrow Screenshot of expanding the selection before sorting in Excel

4. And click Sort button to open the Sort dialog, under Column section, choose Helper column name that you want to sort by, and use Values under Sort On section, and then select the sort order as you want, see screenshot:

Screenshot of the Sort dialog in Excel with helper column selected

5. And then click OK, in the popped out Sort Warning dialog, please select Sort numbers and numbers stored as text separately, see screenshot:

Screenshot of the Sort Warning dialog in Excel for separating numbers and text

6. Then click OK button, you can see, the data has been sorted to your need.

Screenshot of the final sorted alphanumeric data in Excel

7. At last, you can delete the contents of the helper column as you need.

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!