+ Reply to Thread
Results 1 to 3 of 3

Outline format

Hybrid View

  1. #1
    Registered User
    Join Date
    04-28-2009
    Location
    Cumming,GA
    MS-Off Ver
    Excel 2007
    Posts
    1

    Smile Outline format

    I am creating a directory with categories: main, Sub-category, sub-sub-category. It should look liek this"
    1.0 Main Item x
    1.1 Sub-category x
    1.1.1 Sub-Sub-category x



    The x's are manual insertions n a specific column or box in a form, but when a new main category is added the outline number (1.0) needs to automatically shift to 2.0 and iif a sub-category is entered ti needs to shift ot 1.2 or 1.3, etc. The same holds true for sub-sub-categories. So it may very likely end up looking something like this"

    1.0 Main Category x
    2.0 Main Category x
    2.1 Sub-Category x
    2.2 Sub-Category x
    2.2.1 Sub-sub-Category x
    2.3 Sub-Category x
    2.3.1 Sub-Sub-Category x
    3.0 Main Category, etc. x

    I've discovered that I can label individual columns with 1.0, 1.1, and 1.1.1 and extend them by highlighting two cells and dragging the lower right corner, but I need to create the format that will work automatically and re-start new numbers (3.1 at 3.1, not a contimuation of the last in the column or jumping to 4.0 after it reaches 2.9) . Thank you for your help.

    Mark

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

    Re: Outline format

    This works a little differently than you describe; it uses a control column to set the level.
           --A-- --B--
       1   Level  WBS 
       2     1   1    
       3              
       4     2   1.1  
       5     2   1.2  
       6     3   1.2.1
       7     3   1.2.2
       8     2   1.3  
       9     3   1.3.1
      10     3   1.3.2
      11              
      12     1   2    
      13     2   2.1  
      14     3   2.1.1
      15     3   2.1.2
      16     3   2.1.3
      17     2   2.2  
      18     2   2.3  
      19              
      20     1   3    
      21     2   3.1  
      22     2   3.2  
      23     2   3.3
    The function in B2 and copied down is =NextWBS(A2, B$1:B1)

    The function can be copied across rows where column A is blank.
    Attached Files Attached Files
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Outline format

    Hi, I assume the Text "Main Category" etc is in column "B" with the Ref Number in Column "A" , if so try this.
    Code inserts Numbers in column "A"
    NB:- Make sure you The Words "Sub" in your list, starts with an upper Case, Some or your are Lower.
     Sub Cat()
    Dim Rng As Range, dn As Range, c As Integer
    Dim n As Single, p As Single
    Set Rng = Range(Range("B1"), Range("B" & Rows.Count).End(xlUp))
        For Each dn In Rng
            Select Case dn
                Case Is = "Main Category": p = 0: c = c + 1: dn.Offset(, -1) = c
                Case Is = "Sub-Category": p = 0: n = Application.Max(n, c): n = n + 0.1: dn.Offset(, -1) = n
                Case Is = "Sub-Sub-Category": p = p + 1: dn.Offset(, -1) = n & "." & p
            End Select
    Next dn
    End Sub
    Regards M8ick

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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