+ Reply to Thread
Results 1 to 10 of 10

getting a specific string within a sentence

  1. #1
    Registered User
    Join Date
    06-15-2014
    Posts
    19

    Question getting a specific string within a sentence

    Hi! I was having trouble on getting a text string within a sentence..i hope someone can help me on this.

    example:
    in column A1:
    1 - AMERICA 85 - 90 2 - CHINA

    so i want to get only the 85 - 90 and it will shows on column A3..

    hope you can help me on this one.

    thanks

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: getting a specific string within a sentence

    Hi and welcome to the forum!

    Not enough information to be sure I'm afraid. Is that the only string you're interested in performing the extractions on? If not, and there are others, what general rules do we need to know in order to be certain of which part should be extracted?

    Is it, e.g.: "Extract the part between the 3rd and 6th spaces in the string"?

    Perhaps a few more examples together with your desired results will help clarify.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: getting a specific string within a sentence

    Hi
    I'm not sure you are explaining exactly what you need. However based on the individual example this formula will extract what you need into A3. place the formula in A3:
    =MID(A1,13,7)
    Tony

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: getting a specific string within a sentence

    As XOR LX says, you really need to provide a bigger list of possible variations but trying to make a generalised approach based on what I think your data might look like:
    =MID(A1,FIND(" ",A1,FIND("- ",A1,1)+2)+1,FIND(" ",A1,FIND("- ",A1,FIND("- ",A1)+2)+2)-FIND(" ",A1,FIND("- ",A1,1)+2)-1)

  5. #5
    Registered User
    Join Date
    06-15-2014
    Posts
    19

    Re: getting a specific string within a sentence

    sorry..here's another example:

    A1 1-AMERICA 85 -90 2-CHINA

    A2 3-USA 90 -60 4-ITALY

    A3 5-CHINA 75 -60 6-SPAIN

    SO i want to get:

    A5 85 -90
    A6 90 -60
    A7 75 -60

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: getting a specific string within a sentence

    Thanks, but it's very important that you give precise details.

    For example, in your first example, there were spaces between:

    "1" and "-"

    and

    "-" and "AMERICA"

    (and the same for CHINA), though in your new examples there are no such spaces.

    These sorts of things are crucial for knowing what to look for as part of determining where to perform the extraction. Are you saying that there could be spaces in that part or there could not?

    Regards

  7. #7
    Registered User
    Join Date
    06-15-2014
    Posts
    19

    Re: getting a specific string within a sentence

    Quote Originally Posted by ragulduy View Post
    As XOR LX says, you really need to provide a bigger list of possible variations but trying to make a generalised approach based on what I think your data might look like:
    =MID(A1,FIND(" ",A1,FIND("- ",A1,1)+2)+1,FIND(" ",A1,FIND("- ",A1,FIND("- ",A1)+2)+2)-FIND(" ",A1,FIND("- ",A1,1)+2)-1)

    this one is working! thanks a lot!

  8. #8
    Registered User
    Join Date
    06-15-2014
    Posts
    19

    Re: getting a specific string within a sentence

    thanks for all your answer guys!! i appreciate it.. sorry if i did not put more examples at first..im just new here and im not really used to ask questions on this kind of forum so i don't know how i am going to explain what i want to be the result, but thanks a lot on you guys for giving your ideas!

    thanks

  9. #9
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: getting a specific string within a sentence

    Thanks, although be careful - I don't think it will work on your examples in post #5!

  10. #10
    Registered User
    Join Date
    06-15-2014
    Posts
    19

    Re: getting a specific string within a sentence

    Quote Originally Posted by ragulduy View Post
    Thanks, although be careful - I don't think it will work on your examples in post #5!

    i already tried it and i just adjust something on the formula and it worked so its fine.. thanks!

+ 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. Convert specific number into specific sentence
    By sarangapani in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-26-2013, 03:57 PM
  2. Search for a string in a sentence/ phrase
    By DataMcQueen917 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-09-2011, 06:06 PM
  3. Retrieving the a string from a sentence
    By superkid in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-14-2009, 06:38 AM
  4. adjacent to a specific sentence
    By Pivotrend in forum Excel General
    Replies: 1
    Last Post: 02-07-2006, 09: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