+ Reply to Thread
Results 1 to 17 of 17

Cocktail of Formulas needed to Trim Text. Large text in cell

  1. #1
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Question Cocktail of Formulas needed to Trim Text. Large text in cell

    I have a massive amount of data in each cell. The USEFUL INFORMATION that I need is actually VERY SMALL. However, at the moment i have to read the whole cell to extract what i do need... and there are 100s of rows of this.

    Is there a formula (or perhaps in my case, sets of formulas), that can clean out my text to what I am looking for?

    I have attached an example of what I have, with what I need.
    Column A is what I have, and there are SOME EXAMPLES in Column B of what the resulting text should look like
    Attached Files Attached Files

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    I would suggest using Data - Text To Columns.
    Select Delimited - Next
    Put * in the 'Other' Box and click Finish.
    That will then be split up into columns, each column is what was between each *.
    Just delete the unneeded columns.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    ...or

    =TRIM(MID(SUBSTITUTE("*"&$A2,"*",REPT(" ",125)),375,125))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    If using formula.

    Try...
    =TRIM(MID(SUBSTITUTE(A2,"*",REPT(" ", 100)),200,100))

    EDIT: Disregard this one. I missed bunch that won't be captured by this.
    Ex: Row 777 & below.
    Last edited by CK76; 02-01-2018 at 03:08 PM.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  5. #5
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    Quote Originally Posted by CK76 View Post
    If using formula.

    Try...
    =TRIM(MID(SUBSTITUTE(A2,"*",REPT(" ", 100)),200,100))

    EDIT: Disregard this one. I missed bunch that won't be captured by this.
    Ex: Row 777 & below.
    CK, i am thinking that there 3 or 4 columns will be needed to achieve what i am looking for. Obviously, if all the text had the exact same pre-fix, then one single formula will take care of it. Since this is not the case, Im ok with having for example your formula being column b, and column C being a different derivative that for example captures the text after the word "Additional Description" being the key indicator.

    I knew it was going to be hard and out of my scope. Do you think with multiple columns it will be easier?

  6. #6
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    You can try in different ways, but the convention of writing text: '* some text) * XXXX *' is not kept everywhere. Some texts lack appropriate "stars".

    =TRIM(MID(A2,FIND("")"",A2,1)+2,FIND(""*"",A2,FIND("")"",A2,1)+2)-FIND("")"",A2,1)-2))

  7. #7
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    Quote Originally Posted by Glenn Kennedy View Post
    ...or

    =TRIM(MID(SUBSTITUTE("*"&$A2,"*",REPT(" ",125)),375,125))
    Glen... for the first 278 rows, this works perfect.
    The next couple of dozen rows have no useful text, so that's why i wrote what i did in their B column. If there is no formula that can have written what I have, then i'll leave it saying "Crew Size: 1", and add a 2nd layer formula afterwards removing "Crew Size: 1".

    From rows 321, the naming structure varies, making the formula you created unable to give me the desired result. Do you think you can add an IF function that states that if the words "Additional Description:" are there, then take the text that I want (as seen on B321, B322, B323)? That way, if "Additional Description:" is not there, then the formula you made can come into play.

    Thanks Again!

  8. #8
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    Quote Originally Posted by Jonmo1 View Post
    I would suggest using Data - Text To Columns.
    Select Delimited - Next
    Put * in the 'Other' Box and click Finish.
    That will then be split up into columns, each column is what was between each *.
    Just delete the unneeded columns.
    That would solve what i am looking for in MANY of the rows, but i'd say only 60% of them.

    If i still have to weed out manually the "BAD DATA" even once its in a desired column, then i am still doing 1 by 1 review, which is what I hope not to do.

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    Do you have (or can you create) a list of the key phrases you're looking for in the strings ?

  10. #10
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    Quote Originally Posted by Jonmo1 View Post
    Do you have (or can you create) a list of the key phrases you're looking for in the strings ?
    This is actually a little hard to do. That's why I put example of what i want in column B.

    To give you a rough example though...

    - For the 1st 270 examples, Post #3 has the right formula.
    - Rows 279-320 have no useful info, and that's why i put that in column B.
    - The rows that have the phrase "Additional Description:" need the text after this phrase pops up, if it's there at all, and is needed until the phrase "Crew Size" appears. In Rows 300s this appears.
    - Rows 717 to 720 have no useful data for me to extract.
    - Rows in the late 700s... After the phrase "(CMSPIWSUSER)" comes up, we have a name, a date, and time. AFTER THAT, the text is useful until the word "Switching Center" comes up.

    I think those 5 criteria can cover like 90-95% of what i am looking for.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    That's why we want 10-20 rows of representative data, not 800. You get a bit distracted (bored) after the first few screens worth.

    I'll take another look in the morning.

  12. #12
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    Quote Originally Posted by Glenn Kennedy View Post
    That's why we want 10-20 rows of representative data, not 800. You get a bit distracted (bored) after the first few screens worth.

    I'll take another look in the morning.

    You make a great point Glenn. We see that the first 270 rows are of the same thing, so that would only solve a portion of my issue.
    Since i don't get to choose what gets displayed in Column A, i had thought to just put it all up.
    Sorry for making it harder than it should, and thanks for your help. :-)

  13. #13
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    Quote Originally Posted by Jonmo1 View Post
    Do you have (or can you create) a list of the key phrases you're looking for in the strings ?
    Jonmo, did you get anything?

  14. #14
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    Where does the data come from? I assume its an export from some other system? If so what system are you exporting from and have you looked to see if it has any ability to trim down the information pre-export to Excel?

    Sometimes if pulled from a database or other content system it may be possible to query or limit the output such that you dont get as much stuff you dont need.
    Ways to get help: Post clear questions, explain your overall goal, supply as much background as possible, respond to questions asked of you by those trying to help and post sample(s) files.

    "I am here to help, not do it for people" -Me

  15. #15
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    Quote Originally Posted by Zer0Cool View Post
    Where does the data come from? I assume its an export from some other system? If so what system are you exporting from and have you looked to see if it has any ability to trim down the information pre-export to Excel?

    Sometimes if pulled from a database or other content system it may be possible to query or limit the output such that you dont get as much stuff you dont need.
    From SAP. They have given us VERY VERY LITTLE training on its full capabilities, and management doesn't see it as a priority that we learn its full use. I was lucky I even figured out how to extract this information.

  16. #16
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    Quote Originally Posted by JPWRana View Post
    This is actually a little hard to do. That's why I put example of what i want in column B.

    To give you a rough example though...

    - For the 1st 270 examples, Post #3 has the right formula.
    - Rows 279-320 have no useful info, and that's why i put that in column B.
    - The rows that have the phrase "Additional Description:" need the text after this phrase pops up, if it's there at all, and is needed until the phrase "Crew Size" appears. In Rows 300s this appears.
    - Rows 717 to 720 have no useful data for me to extract.
    - Rows in the late 700s... After the phrase "(CMSPIWSUSER)" comes up, we have a name, a date, and time. AFTER THAT, the text is useful until the word "Switching Center" comes up.

    I think those 5 criteria can cover like 90-95% of what i am looking for.
    Does this help Jonmo1?

  17. #17
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Cocktail of Formulas needed to Trim Text. Large text in cell

    Sorry, I've kinda walked away from this thread.
    When you said you didn't have or can't create a list of key phrases, my idea was eliminated from possibility.

+ 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] pull numbers from text - trim text portion
    By jackf-nc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-11-2017, 09:47 AM
  2. Formulas that disregard text, support needed
    By halgraham in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-15-2013, 01:50 PM
  3. Replies: 2
    Last Post: 12-30-2011, 06:22 PM
  4. Replies: 4
    Last Post: 04-11-2011, 08:41 PM
  5. [SOLVED] Text not continuing to wrap for large block of text in Excel cell
    By Mandra in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-15-2006, 02:15 PM
  6. Replies: 3
    Last Post: 12-23-2005, 12:30 PM
  7. [SOLVED] Excel formulas to create large blocks of text
    By Greg Boettcher in forum Excel General
    Replies: 5
    Last Post: 06-12-2005, 02:05 PM

Tags for this Thread

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