+ Reply to Thread
Results 1 to 12 of 12

Sort numbers with multiple decimal points [WBS numbers]

  1. #1
    Registered User
    Join Date
    11-25-2014
    Location
    Swindon, England
    MS-Off Ver
    2013
    Posts
    30

    Sort numbers with multiple decimal points [WBS numbers]

    Hi there everyone.
    I currently have a list of records on a spreadsheet in the following format.

    WBS Title Info
    1 Make Cup of tea The action of making a cup of tea
    1.1 Check ingredients are available Check cupboard, fridge and pantry.
    1.1.1 Check for milk
    1.1.2 Check for sugar
    1.1.3 Check for teabags
    1.2 Test kettle
    1.3 Fetch correct mug Mug preference sheet on the back of door
    etc.


    The structure has 6 levels all the way down to #.#.#.#.#.# and there are sometimes more than 10 levels in each part of the hierarchy (1.14.1.12 is not uncommon).

    I need
    a way to be able to sort the above list so it is in the above order (currently the list is all over the place). Other fixes online explain that splitting the columns using text to columns and then doing a multiple sort will fix it, however a caveat for this is to replace any blank spaces with a 0. i.e. in the above example it would go from 1.14.1.12 to 01.14.01.12. This fix was used for sorting IP addresses which always have the same amount of hierarchical level, but doesn't apply here.

    This fix works great when adding the zeros is quick, however my spreadsheet is so large it is unfeasible to fill the information in this format.

    I'm thinking that we need some sort of loop VBA macro which sorts based on the first digit, then within those groups sorts on the next digit etc.
    The issue I foresee with this though is the following situation will occur.
    1.1.1.1
    1.1.1.2
    1.1.1
    1.1.2.1
    1.1.2.3
    1.1.2
    1.1
    1.1
    2.1.1.1
    2.1.1.2
    2.1.1.

    So between my first level the groups are ordered, however the logic isnt there to tell the rest of the sorting what to do.

    All help is much appreciated WBS Example.xlsx
    Last edited by 6StringJazzer; 03-20-2017 at 08:57 PM.

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Sort numbers with multiple decimal points

    attach sample file
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Registered User
    Join Date
    11-25-2014
    Location
    Swindon, England
    MS-Off Ver
    2013
    Posts
    30

    Re: Sort numbers with multiple decimal points

    Example is attached

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Sort numbers with multiple decimal points

    see the attached file
    one helper column was created
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-25-2014
    Location
    Swindon, England
    MS-Off Ver
    2013
    Posts
    30

    Re: Sort numbers with multiple decimal points

    What a fantastic fix! Works really well.
    Thank you so much! This has roughly tripled my productivity ha ha

  6. #6
    Registered User
    Join Date
    11-25-2014
    Location
    Swindon, England
    MS-Off Ver
    2013
    Posts
    30

    Re: Sort numbers with multiple decimal points

    Now I'm trying to apply it to my own work, it's not really working. Could you talk me through what the formula is actually doing so I can try and diagnose where I'm going wrong?

  7. #7
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Sort numbers with multiple decimal points

    It is an array formula
    Stay in the cell
    Press F2
    Then press Shift+Ctrl+Enter keys at a time

  8. #8
    Registered User
    Join Date
    11-25-2014
    Location
    Swindon, England
    MS-Off Ver
    2013
    Posts
    30

    Re: Sort numbers with multiple decimal points

    Perfect Thank you so much!

  9. #9
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Sort numbers with multiple decimal points

    See the attached file
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    05-19-2016
    Location
    Colorado Springs
    MS-Off Ver
    2007
    Posts
    1

    Re: Sort numbers with multiple decimal points

    5 1/2 years later, this post was exactly what I was looking for. THANKS!

  11. #11
    Registered User
    Join Date
    03-20-2017
    Location
    Nashua, NH
    MS-Off Ver
    2016
    Posts
    1

    Re: Sort numbers with multiple decimal points

    I can't get this to work, e.g. add 1.1.10 to the example worksheet and it sorts between 1.10 and 1.11 instead of between 1.1.4 and 1.2

    Am I missing something? Thanks!

  12. #12
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Sort numbers with multiple decimal points

    Quote Originally Posted by kz0ku View Post
    I can't get this to work, e.g. add 1.1.10 to the example worksheet and it sorts between 1.10 and 1.11 instead of between 1.1.4 and 1.2

    Am I missing something? Thanks!
    You're not missing anything. That solution doesn't work when there are double-digit numbers. I request that you open a new thread with your question and provide a sample file of what you are working with.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How do you sort item numbers targeting only specific numbers?
    By matt323 in forum Excel General
    Replies: 10
    Last Post: 12-29-2013, 01:15 AM
  2. Replies: 1
    Last Post: 12-28-2013, 11:46 PM
  3. [SOLVED] sort using vba want to sort text-as-numbers
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2013, 11:46 AM
  4. sort numbers in numeric form in a cell and down the rows
    By system in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-09-2012, 12:15 AM
  5. [SOLVED] How to merge a numbers from 3 cells, eliminate repetitive numbers, and sort such numbers?
    By david gonzalez in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-22-2012, 11:59 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1