+ Reply to Thread
Results 1 to 8 of 8

Need to build a path based on text indent level

  1. #1
    Registered User
    Join Date
    10-23-2011
    Location
    Sydney Australia
    MS-Off Ver
    Excel for Mac V16.39
    Posts
    68

    Need to build a path based on text indent level

    Hi,
    I have a category system that is created by a web site. There are 4 levels to my categories and my system spits it all out in a single column
    eg
    Musical Instruments
    ~~Strings
    ~~~~Pianos
    ~~~~~~Grand
    ~~~~~~Concert
    ~~Woodwind
    ~~~~Flute
    ~~~~Oboe

    I need these expressed as a path.

    e.g
    \Musical instruments\Strings\Pianos\Grand\
    \Musical instruments\Strings\Pianos\Concert
    \Musical Instruments\Woodwind\Flute\
    \Musical Instruments\Woodwind\Oboe\

    The indents always have a specific number of spaces in front of them so I can easily add a helper column with level number.

    I've attached a spreadsheet with an example.

    Any help would be greatly appreciated.

    Thanks

    Note: It looks like the forum has stripped the spaces from in front of the text so I have replaced them with a tilde
    Attached Files Attached Files
    Last edited by ozbrian; 07-18-2020 at 02:55 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,972

    Re: Need to build a path based on text indent level

    Please update your forum profile with your current version of Excel - I suspect you have updated from Excel 2007. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Need to build a path based on text indent level

    Please Login or Register  to view this content.
    But there is small problem in the row 28. Number of spaces in front of level name is les then usual.
    Attached Files Attached Files

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,972

    Re: Need to build a path based on text indent level

    It might be worth pointing out that the OP will need to replace semi-colons in the formula with commas for the Australian locale:

    =IF((FIND(LEFT(TRIM(A2)),A2)+1)/2=1,"\"&A2&"\",LOOKUP(2,1/((FIND(LEFT(TRIM(A$2:A2)),A$2:A2)+1)/2=(FIND(LEFT(TRIM(A2)),A2)+1)/2),C$2:C2)&TRIM(A2)&"\")
    Last edited by AliGW; 07-18-2020 at 04:00 AM.

  5. #5
    Registered User
    Join Date
    10-23-2011
    Location
    Sydney Australia
    MS-Off Ver
    Excel for Mac V16.39
    Posts
    68

    Re: Need to build a path based on text indent level

    Quote Originally Posted by AliGW View Post
    Please update your forum profile with your current version of Excel - I suspect you have updated from Excel 2007. Thanks.
    Done!. Thanks

  6. #6
    Registered User
    Join Date
    10-23-2011
    Location
    Sydney Australia
    MS-Off Ver
    Excel for Mac V16.39
    Posts
    68

    Re: Need to build a path based on text indent level

    Quote Originally Posted by BMV View Post
    Please Login or Register  to view this content.
    But there is small problem in the row 28. Number of spaces in front of level name is less then usual.
    Perfect. Thanks BMV. It's amazing how you have strung all those arguments together. My row 28 error was a typo. Hopefully I can learn a few things from your formula.
    And thanks for such a quick response!

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,972

    Re: Need to build a path based on text indent level

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  8. #8
    Registered User
    Join Date
    10-23-2011
    Location
    Sydney Australia
    MS-Off Ver
    Excel for Mac V16.39
    Posts
    68

    Re: Need to build a path based on text indent level

    Quote Originally Posted by AliGW View Post
    It might be worth pointing out that the OP will need to replace semi-colons in the formula with commas for the Australian locale:

    =IF((FIND(LEFT(TRIM(A2)),A2)+1)/2=1,"\"&A2&"\",LOOKUP(2,1/((FIND(LEFT(TRIM(A$2:A2)),A$2:A2)+1)/2=(FIND(LEFT(TRIM(A2)),A2)+1)/2),C$2:C2)&TRIM(A2)&"\")
    Thanks AliGW. When I opened BMV's spreadsheet it worked fine, Excel must have automatically updated the formula.

    Cheers

+ 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. Group WBS Rows Automatically Based on Indent Level (VBA)
    By rsfx in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2024, 06:26 PM
  2. [SOLVED] Recursively Indent Cell Text based on Another Cell
    By dchanson in forum Excel General
    Replies: 3
    Last Post: 05-03-2019, 10:11 AM
  3. Concatenate hierarchy string depending on indent level
    By Virgule in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2019, 06:08 PM
  4. [SOLVED] Indent text to extent of hierarchical outline level
    By snapfade in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-21-2013, 03:24 PM
  5. Move files up one level in the path.
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2010, 05:57 PM
  6. Determine minimum indent level of selected cells
    By gnethery in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-28-2009, 10:48 PM
  7. How can I query the 'indent' level of text in a cell?
    By NJDevil in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-12-2005, 12:05 PM

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