+ Reply to Thread
Results 1 to 13 of 13

Text to Column based on Bold/Regular Text

  1. #1
    Registered User
    Join Date
    11-13-2018
    Location
    Istanbul
    MS-Off Ver
    Microsoft 365
    Posts
    91

    Text to Column based on Bold/Regular Text

    Hello all

    I was recently asked to include the name of customers to a report I've been making. Problem is, the tool that is giving me this data also puts a bunch of other unwanted information in the same cell.

    Eg: "Customer name License no Rezervation no Bunch of characters that appear to be random"

    I would have used "Text to Columns" but the only thing that's separating these informations is bold formatting. And since the customers can have 3 names, 2 surnames and vary in length & character number, I haven't been able to think of a working method for all cases.

    Is it possible to do this (via Text to Columns or any other method)?

    PS: One thing that might help is all "Licence No" appear to include at least 1 numerical character (you can see in attached sample), but since the data is thousands of rows I haven't been able to confirm this, so I don't quite want to rely on it. Still, thought I'd mention it.

    Best regards
    Attached Files Attached Files

  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,460

    Re: Text to Column based on Bold/Regular Text

    You cannot use formatting as an identifier in either Text to Columns OR a formula.

    Best I can offer (but it will pull only the first two words):

    =TRIM(LEFT(SUBSTITUTE(A2," ",REPT(" ",99)),198))

    If you can establish a logic, then we might be able to improve on this, however with the alphanumeric codes as they are, I really can't see one.
    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
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: Text to Column based on Bold/Regular Text

    1. does the reservation number ALWAYS have a hyphen in it?

    2. is the string between the name and the reservation number ALWAYS only 1 string of unknown length of random characters? or can it be more than 1 string?
    for example, is it only string1010 or can it be string1010 string2ewe

  4. #4
    Registered User
    Join Date
    11-13-2018
    Location
    Istanbul
    MS-Off Ver
    Microsoft 365
    Posts
    91

    Re: Text to Column based on Bold/Regular Text

    1- It does always have hyphen.
    2- Just 1. Length can vary though, sometimes it's 3 characters, sometimes up to 15-20. But always only 1 string.
    Last edited by AliGW; 11-01-2021 at 11:26 AM. Reason: PLEASE don't quote unnecessarily!

  5. #5
    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,460

    Re: Text to Column based on Bold/Regular Text

    Do you have a definitive list of customer names?

    If you do, then you can use this:

    =IFERROR(LOOKUP(1000,SEARCH(list_of_customers,A2),list_of_customers),"")
    Attached Files Attached Files
    Last edited by AliGW; 11-01-2021 at 11:31 AM.

  6. #6
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: Text to Column based on Bold/Regular Text

    in cell C2, try this formula, and drag down:
    Please Login or Register  to view this content.

  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,460

    Re: Text to Column based on Bold/Regular Text

    That's a MONSTER, Jan!

  8. #8
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: Text to Column based on Bold/Regular Text

    @AliGW, hahaha, yeaaa... sorry.... im not a master in excel, i pieced it together by first getting the data before and including the hyphen, then using that particle to extract before the last space, then doing it again....

    heres the worksheet....


    i have worked out how to do the second last space without nesting again, so here is the revised formula:

    Please Login or Register  to view this content.
    Last edited by janmorris; 11-01-2021 at 02:07 PM.

  9. #9
    Registered User
    Join Date
    11-13-2018
    Location
    Istanbul
    MS-Off Ver
    Microsoft 365
    Posts
    91

    Re: Text to Column based on Bold/Regular Text

    "im not a master in excel"

    Looks to me you are! I'm at a loss of words. Brilliant! Many thanks Sent rep

    I will study your steps and see if I can understand your logic - and the functions you used: I'm not familiar with the FIND and SUBSTITUTE functions.. Guess you learn new things everyday
    Last edited by AliGW; 11-02-2021 at 04:19 AM. Reason: PLEASE don't quote unnecessarily!

  10. #10
    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,460

    Re: Text to Column based on Bold/Regular Text

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

    Also, if you have not already done so, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

  11. #11
    Registered User
    Join Date
    11-13-2018
    Location
    Istanbul
    MS-Off Ver
    Microsoft 365
    Posts
    91

    Re: Text to Column based on Bold/Regular Text

    Hi Ali

    I didn't mark it solved for now in case I have further questions. But I will, don't worry

    Thanks!

  12. #12
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Text to Column based on Bold/Regular Text

    the below may be a fraction shorter
    =LEFT($A2,FIND("-",$A2)) finds the string ending with the -


    =FIND("^",SUBSTITUTE(A2," ","^",LEN(A2)-LEN(SUBSTITUTE(A2," ",""))-1)) finds the 2nd last space, we want this in the above formula
    so substituting for a2
    =FIND("^",SUBSTITUTE(LEFT($A2,FIND("-",$A2))," ","^",LEN(LEFT($A2,FIND("-",$A2)))-LEN(SUBSTITUTE(LEFT($A2,FIND("-",$A2))," ",""))-1))

    we want the left of this string this many character -1
    =LEFT(A2,FIND("^",SUBSTITUTE(LEFT($A2,FIND("-",$A2))," ","^",LEN(LEFT($A2,FIND("-",$A2)))-LEN(SUBSTITUTE(LEFT($A2,FIND("-",$A2))," ",""))-1))-1)

    perhaps a fraction shorter

  13. #13
    Registered User
    Join Date
    11-13-2018
    Location
    Istanbul
    MS-Off Ver
    Microsoft 365
    Posts
    91

    Re: Text to Column based on Bold/Regular Text

    Thanks everyone for all the help!

+ 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] Sort column based on BOLD text
    By Aland2929 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-27-2017, 04:09 AM
  2. Split column by bold-normal text
    By thebigbopper in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2016, 01:31 PM
  3. [SOLVED] split or extract text based on bold properties
    By mariomp in forum Excel General
    Replies: 4
    Last Post: 08-19-2016, 09:34 AM
  4. code for moving bold text one column before
    By stephme55 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2015, 02:48 PM
  5. Split cell - bold text and non bold text.
    By desertshift in forum Excel General
    Replies: 10
    Last Post: 11-21-2010, 08:13 PM
  6. Delete all text which is not 'bold' in cells with 'mingled bold' text
    By Excelfriend in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-23-2010, 04:47 PM
  7. Inserting a comment that has some bold text and some regular text
    By hoopz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-31-2006, 06:09 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