+ Reply to Thread
Results 1 to 19 of 19

Looking for a fromula to extract certain text from a string

  1. #1
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Looking for a fromula to extract certain text from a string

    Hi I need help extracting a certain string of numbers and text from a string of text.

    Example

    String 12 3 4 abc4567 435 fgt 3.456 abcd

    I need to extract abc4567 435

    Is this possible please

    Many thanks

    John

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Looking for a fromula to extract certain text from a string

    What's the logic behind why "abc4567 435" should be extracted from "String 12 3 4 abc4567 435 fgt 3.456 abcd"?

    Will the desired result always be in-between the 4th and 6th spaces or something like that?

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Looking for a fromula to extract certain text from a string

    Hi John,

    See if this type of formula works for you,

    =TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",100)),400,200))

    Extract String using Space Rept and Trim.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Looking for a fromula to extract certain text from a string

    All the desired extracted will be 3 letters followed by 4 numbers a space and then another four numbers this will be absolute for each extract so example bcd4321 123 or gbg4567 655 the sequence could appear 4 characters into the string or 20 characters into the string.

    Marvin, I tried the formula but it didn't return what I was looking for, cheers anyway mate

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Looking for a fromula to extract certain text from a string

    Quote Originally Posted by john dalton View Post
    3 letters followed by 4 numbers a space and then another four numbers
    This (abc4567 435) is 3 letters followed by 4 numbers, a space, and then 3 numbers...

    I'm sure this was nothing more than a typo. Either way, this will probably require VBA.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Looking for a fromula to extract certain text from a string

    If you want a better answer you need to give us more examples using an attached worksheet.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  7. #7
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Looking for a fromula to extract certain text from a string

    Here is an example attached

    Cheers

    John
    Attached Files Attached Files

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Looking for a fromula to extract certain text from a string

    Hi John,
    Try this one
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  9. #9
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Looking for a fromula to extract certain text from a string

    Hi Alkey that's a great start, how would I adapt that if the text was different so and entry might say cde1234 567 is there a flexible way of looking for any 3 letters at the start of the sequence.

    Cheers

    John

  10. #10
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Looking for a fromula to extract certain text from a string

    If that (post #7) was a representative sample, then E5 ="abc1234 567" would work.
    I'm sure this isn't the case.

    Do the desired strings always come directly before " 279.000"?
    If not, I suggest making your sample representative of your actual data.

  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
    43,984

    Re: Looking for a fromula to extract certain text from a string

    Alkey, I think (post 4) its ANY three letters/4 numbers/space/3 numbers.

    I can get the three numbers OK... but am struggling with the 7 character string....
    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

  12. #12
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Looking for a fromula to extract certain text from a string

    Yes the abd1234 567 combination always appears before a 5 or 6 digit number with a decimal point in it (example 12.3456 or 1.2345)

    Cheers

    john

  13. #13
    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
    43,984

    Re: Looking for a fromula to extract certain text from a string

    Try:

    =RIGHT(LEFT(A1,SEARCH(".",A1)-7),11)

    edit: no. won't work for 12.3456

  14. #14
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Looking for a fromula to extract certain text from a string

    If that's the case, then this would work:

    E5 =LEFT(RIGHT(C5,20),11)

    Again, this is assuming that the sample that you shared is representative of your actual data.

  15. #15
    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
    43,984

    Re: Looking for a fromula to extract certain text from a string

    This should do it:

    =RIGHT(TRIM(LEFT(A7,SEARCH(".",A7)-7)),11)

  16. #16
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Looking for a fromula to extract certain text from a string

    Hi Glenn, Absolute genius mate, works a treat the =RIGHT(TRIM(LEFT(A7,SEARCH(".",A7)-7)),11) formula is the one.

    Many thanks to everyone on this much appreciated.

    John

  17. #17
    Forum Contributor
    Join Date
    04-02-2010
    Location
    penrith
    MS-Off Ver
    Excel 2007
    Posts
    522

    Re: Looking for a fromula to extract certain text from a string

    Glenn, that's on the money mate the =RIGHT(TRIM(LEFT(A7,SEARCH(".",A7)-7)),11) formula works brilliantly, thank you to everyone who contributed.

    Much appreciated

    John

  18. #18
    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
    43,984

    Re: Looking for a fromula to extract certain text from a string

    You're welcome.



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

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  19. #19
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Looking for a fromula to extract certain text from a string

    Try this
    Enter formula in B1 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    With lookup table in D2:D3
    v A B C D
    1 String 12 3 4 abc4567 435 fgt 3.456 abcd abc4567 435 abc
    2 String 12 3 4 cde4567 435 fgt 3.456 abcd cde4567 435 bcd
    3 String 12 3 4 abc4567 435 fgt 3.456 abcd abc4567 435 cde
    4 String 12 3 4 bcd4567 435 fgt 3.456 abcd bcd4567 435
    5
    Last edited by AlKey; 03-16-2018 at 10:11 AM.

+ 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] Fromula to extract Date & Time value from weird string value
    By green_bean_4_u in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-22-2014, 07:02 PM
  2. [SOLVED] Extract text from a given point in a text string, when data points do not share the given
    By reedersketer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-09-2014, 03:57 PM
  3. [SOLVED] Find and extract text string from within another text string
    By huy_le in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-12-2013, 03:22 PM
  4. Find and extract text string from within another text string
    By huy_le in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-09-2013, 09:01 PM
  5. [SOLVED] How to Extract A Number from String if Text within the String Equals XYZ
    By tyrsfury in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-15-2012, 03:30 PM
  6. [SOLVED] extract text string when you only know the last three letters of that string
    By alison0edwards in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-12-2012, 01:20 PM
  7. Extract small string of text from larger string
    By mark_jam3s in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2010, 05:36 AM

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