+ Reply to Thread
Results 1 to 6 of 6

Assign Indent Number depending on leading spaces !!!

  1. #1
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Assign Indent Number depending on leading spaces !!!

    In column A, I have strings with Leading spaces !
    I want to assign a code number (indent number) to B , driven by Leading spaces in A :

    I want to compare LEN(of leading spaces in A) and assign indent level function of LEN

    If Len(leading)=0, Then 0
    If next Len(Leading)= say 3, Then 1
    If next Len(Leading)= say 4, Then 2
    If next Len(Leading)= say 7, Then 3

    up to 10 leading spaces, possibilities

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Assign Indent Number depending on leading spaces !!!

    Do you have other spaces within the strings in column A ?

    Pete

  3. #3
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Assign Indent Number depending on leading spaces !!!

    No, string do not have any other spaces like "inside of string"
    I also know that I have 8 characters in A (8 without leading spaces) so if len(a)=8 there are no any spaces, then assign 0

  4. #4
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: Assign Indent Number depending on leading spaces !!!

    Please Login or Register  to view this content.
    With this formula you can count leading spaces
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  5. #5
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Assign Indent Number depending on leading spaces !!!

    So how to assign Indent ?
    If LEN(A1)-LEN(TRIM(A1))=0 THEN 0
    Now I have to compare them...

    Like :
    If LEN(A1)-LEN(TRIM(A1))=say 3 THEN 1
    If LEN(A1)-LEN(TRIM(A1))=say 7 THEN 2
    If LEN(A1)-LEN(TRIM(A1))=say 11 THEN 3
    Last edited by ionelz; 03-26-2020 at 08:53 AM.

  6. #6
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: Assign Indent Number depending on leading spaces !!!

    With vlookup you can do that.
    Attached Files Attached Files

+ 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] assign unique number to rows depending on cell content
    By bob33 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-27-2019, 04:29 PM
  2. 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
  3. assign automatically tab indent in bullet & numbering
    By tadbirgaran in forum Word Formatting & General
    Replies: 1
    Last Post: 10-23-2018, 04:49 PM
  4. How to remove leading spaces
    By Terressa in forum Excel General
    Replies: 4
    Last Post: 06-27-2015, 07:45 PM
  5. Deleting leading and trailing spaces from a number
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-31-2009, 11:25 PM
  6. trim leading spaces
    By captain bob in forum Excel General
    Replies: 2
    Last Post: 08-03-2006, 10:00 AM
  7. [SOLVED] How do I add leading spaces to a value?
    By Chris Brown in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-03-2006, 01:35 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