+ Reply to Thread
Results 1 to 6 of 6

Hierarchical Sorting Problem

  1. #1
    Registered User
    Join Date
    10-21-2014
    Location
    Rancho Santa Margarita, CA
    MS-Off Ver
    Office for Mac 2011
    Posts
    3

    Hierarchical Sorting Problem

    I have the need to sort the output of a set of process steps into their sequential order. The problem is, the process are numbered according to their place in a hierarchy. For example, I may have a "Process 6.0 Manage Inventory" that contains level 1 processes
    6.1 Receive Inventory
    6.2 Ship Inventory
    6.3 Adjust Inventory

    Then within 6.1 Receive Inventory, the following sub-processes:
    6.1.1 Receive Advanced Shipment Notification
    6.1.2 Schedule Receipt
    6.1.3 Initiate Receipt
    ...
    6.1.10 Finalize Receipt

    Since these are no longer "numbers" once you add the second decimal point, they won't sort like numbers. My thought is to add a leading 0 to each nested level, but that is proving to be quite the challenge, and I'd rather not clutter up the numbering with embedding those into my process flow diagrams (the origination is Visio).

    Has anybody run into / solved this problem? I'd be okay with creating a "sort" field that basically restructures the number with leading zeroes to ensure the sort is correct -- that is,

    6.1.1 becomes 06.01.01, 6.1.2 --> 06.01.02, etc...

    Thanks!

    Rob

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Hierarchical Sorting Problem

    Welcome to the board.

    Please Login or Register  to view this content.
    Use the UDF in a different column and sort by that column:
    Row\Col
    A
    B
    C
    D
    1
    WBS
    Description
    Sort By
    2
    6.1 Whatever 06.01 C2: =padnum(A2, 2)
    3
    6.1.1 Whatever 06.01.01
    4
    6.1.2 Whatever 06.01.02
    5
    6.1.3 Whatever 06.01.03
    6
    6.1.4 Whatever 06.01.04
    7
    6.1.5 Whatever 06.01.05
    8
    6.1.6 Whatever 06.01.06
    9
    6.1.7 Whatever 06.01.07
    10
    6.1.8 Whatever 06.01.08
    11
    6.1.9 Whatever 06.01.09
    12
    6.1.10 Whatever 06.01.10
    13
    6.2 Whatever 06.02
    14
    6.3 Whatever 06.03
    15
    6.4 Whatever 06.04
    16
    6.5 Whatever 06.05
    17
    6.6 Whatever 06.06
    18
    6.7 Whatever 06.07
    19
    6.8 Whatever 06.08
    20
    6.9 Whatever 06.09
    Last edited by shg; 11-18-2015 at 08:27 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-21-2014
    Location
    Rancho Santa Margarita, CA
    MS-Off Ver
    Office for Mac 2011
    Posts
    3

    Re: Hierarchical Sorting Problem

    This is perfect! Exactly what I needed. Thanks so much for the ultra-fast reply!

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Hierarchical Sorting Problem

    You're welcome.

  5. #5
    Registered User
    Join Date
    10-21-2014
    Location
    Rancho Santa Margarita, CA
    MS-Off Ver
    Office for Mac 2011
    Posts
    3

    Re: Hierarchical Sorting Problem

    Ok -- now I'm feeling stupid. I've successfully used UDF's before, but this function is continually returning the dreaded #NAME? error. Best I can tell, I embedded the VBA in the correct location in the spreadsheet, and I'm getting no errors -- but nothing I do seems to be able to overcome this error. Using Mac 2011 (but have tried on Windows 2010 as well) -- same problem.

    I'm sure this is an easy fix...but I'm stumped. Sorry to be so obtuse, but any additional help would be tremendously appreciated.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Hierarchical Sorting Problem

    Copy the code from the post.

    In Excel, Alt+F11 to open the VBE, Insert > Module, paste the code in the window that opens.

    Save as an xlsm file, close, reopen, enable macros when prompted.

+ 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. Macro for hierarchical Setup?
    By mwelch1280 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2015, 10:53 AM
  2. Hierarchical Problem
    By inkos in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-27-2015, 11:44 AM
  3. Rearrange Hierarchical Data
    By stusic in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-15-2015, 01:46 PM
  4. Help with Hierarchical Structure in Excel
    By JKtoC in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2015, 03:33 PM
  5. How do I group rows hierarchical (1, 1.1, 1.1.2 ...)
    By jugeh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2013, 05:19 PM
  6. Displaying a hierarchical representation of a dataset
    By Geelong Videos in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2011, 02:05 AM
  7. Hierarchical List
    By Paul in forum Excel General
    Replies: 1
    Last Post: 08-02-2006, 09:05 AM

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