Sort Hierarchical Numbers in Excel Correctly
Question details
Sort labels such as 1.1, 1.2, and 1.10 by their numeric hierarchy rather than as text.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains two-part hierarchical labels that need to be sorted by major and minor number.
- Observed behavior
- Text sorting places 1.10 before 1.2 because it compares characters rather than the numeric parts of each label.
Check that the labels are stored as text and each has two nonnegative integer parts separated by a period. If Excel already converted 1.10 to the numeric value 1.1, restore the original label as text before sorting; the lost trailing zero cannot be recovered from the number alone.
Sort by separate major and minor number columns
Use two numeric helper columns to sort two-part labels while keeping the original labels unchanged.
Add columns named Major and Minor next to the labels. For these examples, assume the first label is in A2.
In the Major cell for row 2, enter =--LEFT(A2,FIND(".",A2)-1), then fill the formula down alongside all labels.
In the Minor cell for row 2, enter =--MID(A2,FIND(".",A2)+1,LEN(A2)), then fill the formula down alongside all labels.
Select the entire data range, including the helper columns, and choose Data > Sort. Select Major and Smallest to Largest, then choose Add Level and sort Minor from Smallest to Largest. Confirm with OK.
Sort Hierarchical Numbers in WPS Spreadsheets
Use numeric helper columns and a multi-level sort in WPS Spreadsheets to arrange two-part labels without changing their displayed text.
- 1. Open the worksheet: Open your Excel workbook in WPS Spreadsheets and check that the two-part labels are stored as text.
- 2. Create numeric helpers: Add Major and Minor columns. If the first label is in A2, enter =--LEFT(A2,FIND(".",A2)-1) for Major and =--MID(A2,FIND(".",A2)+1,LEN(A2)) for Minor, then fill both formulas down.
- 3. Sort the full range: Select the full data range and open Data > Sort. Sort Major from smallest to largest, add a level for Minor in the same order, and apply the sort.

Frequently Asked Questions
Why does Excel sort 1.10 before 1.2?
When the labels are text, Excel compares characters from left to right. Use numeric Major and Minor helper columns and sort by both under Data > Sort.
Can I recover 1.10 if Excel changed it to 1.1?
Not from the numeric value alone: Excel stores 1.10 and 1.1 as the same number. Restore the original label from the source, format the destination cells as Text using Home > Number Format, and reenter or import the labels.
Will these formulas work for labels such as 1.2.3?
No. The formulas are for labels with exactly two integer parts. For three-part labels, extract each part into a separate numeric helper column and add a sort level for each column.
Can I hide the helper columns after sorting?
Yes. Select the helper column headers, right-click, and choose Hide. The sorted rows and original labels remain visible.




