+ Reply to Thread
Results 1 to 11 of 11

Extract 1, 2 or 3 words from middle of text in a cell

  1. #1
    Forum Contributor
    Join Date
    05-01-2008
    Posts
    165

    Extract 1, 2 or 3 words from middle of text in a cell

    Hi,

    Is it possible to extract words from text like this?


    RETAILER ALL SALES Extra Foods British Columbia

    I only want to extra Extra Food.


    I've tried different formulas, but only worked if included 1st or last word.

    Please help me.

    Thanks.
    Last edited by Vinnie Chan; 08-31-2010 at 02:58 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Extract 1, 2 or 3 words from middle of text in a cell

    Hi,

    What do YOU mean by extract. If all you want to do is remove the characters 'Extra Foods' just use the Find and Replace (with "") functionality.

    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    05-01-2008
    Posts
    165

    Re: Extract 1, 2 or 3 words from middle of text in a cell

    I have a list of banners (supermarkets) with categories in front and regions at the end. I only want the name of supermarkets.

    for example:

    RETAILER ALL SALES Tl Retailer National
    RETAILER ALL SALES Dominion - Nfld Newfoundland
    RETAILER ALL SALES Save Easy Newfoundland
    RETAILER ALL SALES Maritimes Maritimes
    RETAILER ALL SALES Atl Superstore Maritimes
    RETAILER ALL SALES Atlantic SuperValu Maritimes
    APPAREL Tl Retailer National
    APPAREL Dominion - Nfld Newfoundland
    APPAREL Save Easy Newfoundland
    APPAREL Maritimes Maritimes
    APPAREL Atl Superstore Maritimes
    APPAREL Atlantic SuperValu Maritimes
    BAKERY Tl Retailer National
    BAKERY Dominion - Nfld Newfoundland
    BAKERY Save Easy Newfoundland
    BAKERY Maritimes Maritimes
    BAKERY Atl Superstore Maritimes
    BAKERY Atlantic SuperValu Maritimes
    DELI Tl Retailer National
    DELI Dominion - Nfld Newfoundland
    DELI Save Easy Newfoundland
    DELI Maritimes Maritimes
    DELI Atl Superstore Maritimes
    DELI Atlantic SuperValu Maritimes

    I only want the names of supermarkets (highlighted in red). The list is a lot bigger than this and need to be updated weekly.

    Is this doable?

    Thanks for your help.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Extract 1, 2 or 3 words from middle of text in a cell

    This might help.

    http://www.ozgrid.com/VBA/extract-words-function.htm

    EDIT: now you've properly explained your problem, that link probably won't help.

  5. #5
    Forum Contributor
    Join Date
    05-01-2008
    Posts
    165

    Re: Extract 1, 2 or 3 words from middle of text in a cell

    Thanks for your help. I followed the instruction, but didn't work. Don't know what I've done wrong.

    Is there a way to set up a formula instead of VBA?

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Extract 1, 2 or 3 words from middle of text in a cell

    I see you have multiples of the same stores...

    Can you list all the possible stores somewhere off to the side,

    then use a formula to check your strings for those stores and then extract those.

    Eg.

    If you list the stores in I1:I5 then apply formula:

    Please Login or Register  to view this content.
    copied down.

    Does that help?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  7. #7
    Forum Contributor
    Join Date
    05-01-2008
    Posts
    165

    Re: Extract 1, 2 or 3 words from middle of text in a cell

    Hi NBVC,

    Thanks for your help. But I don't really understand what you mean. If my whole list is in Col L, should I list out all stores in one column (i.e., Col M) and apply the formula in Col N or any col?

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Extract 1, 2 or 3 words from middle of text in a cell

    If your starting list (like sample you posted) is in column L.. then create a list of all the stores (i.e. the parts you want to extract from the list in column L) somewhere away from the main area (even on another sheet). Then in column M use the formula above with adjustments to the range I1:I5 to coincide with where your list of stores is....

    See attached.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    05-01-2008
    Posts
    165

    Re: Extract 1, 2 or 3 words from middle of text in a cell

    Hi NBVC,

    Something strange. It works if I don't change anything. When I expand my store list to I1:I19, nothing shows up.

    Can you please tell me why?

    Thanks.

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Extract 1, 2 or 3 words from middle of text in a cell

    Are there blanks in that range?

    Try:

    Please Login or Register  to view this content.
    Last edited by NBVC; 08-31-2010 at 03:05 PM. Reason: typo

  11. #11
    Forum Contributor
    Join Date
    05-01-2008
    Posts
    165

    Re: Extract 1, 2 or 3 words from middle of text in a cell

    Hi NBVC,

    There is no blanks in the range. But the last formula you provided works perfect.

    Thanks a million!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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