How to sort {9.2.7, 7.0.10, 10.0.10} kind of values in excel

Anonymous
2023-11-03T10:25:36+00:00

How to sort {9.2.7, 7.0.10, 10.0.10} kind of values in excel

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Andreas Killer 144.1K Reputation points Volunteer Moderator
    2023-11-04T10:22:50+00:00

    You can easily complicate the whole thing:

    Index Header Order
    7.0.10 a 1
    7.2.1 d 2
    7.2 c 3
    7.10.0 e 4
    9.2.7 f 5
    10.0.10 g 6
    11.2.3.5 j 7
    11.2.3.4.7 i 8
    11.2.3.4 h 9
    7.0.10.1 b 10

    Sort all data based on index column. This is the correct result:

    Index Header Order
    7.0.10 a 1
    7.0.10.1 b 10
    7.2 c 3
    7.2.1 d 2
    7.10.0 e 4
    9.2.7 f 5
    10.0.10 g 6
    11.2.3.4 h 9
    11.2.3.4.7 i 8
    11.2.3.5 j 7

    The point is that there is no simple workaround, we must split the Index by . to get the numbers then we can sort the data by that numbers. However you do it.

    Andreas.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-11-03T20:31:35+00:00

    A Python function can sort it more directly, but it's limited (AFAIK) to only 3 levels. (as per your example data)

    Image

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2023-11-03T12:40:44+00:00

    Hi. I would prefer to do it without helper columns.

    Image

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2023-11-03T11:40:55+00:00

    Use same length for each number. Then you can sort it.

    =TEXTJOIN(".",,TEXT(TEXTSPLIT(A2,"."),"00"))

    Was this answer helpful?

    0 comments No comments
  5. Andreas Killer 144.1K Reputation points Volunteer Moderator
    2023-11-03T11:13:11+00:00

    You have to split your text to number parts, e.g.:

    .

    Now you can sort all data, by a,b,c and get the desired result. There are several ways to perform the split, I suggest to copy column A to B, then use "Text to Columns". https://support.microsoft.com/en-us/office/split-text-into-different-columns-with-the-convert-text-to-columns-wizard-30b14928-5550-41f5-97ca-7a3e9c363ed7

    Andreas.

    Was this answer helpful?

    0 comments No comments