+ Reply to Thread
Results 1 to 10 of 10

How to extract a particular word(s) from a cell in excel that matches a list of values

  1. #1
    Registered User
    Join Date
    12-09-2016
    Location
    U.K
    MS-Off Ver
    Windows 7
    Posts
    4

    How to extract a particular word(s) from a cell in excel that matches a list of values

    Hello everyone,
    I have different text strings in each cell of coloumn A and wish to extract only certain word(s) from it that are present in a list of items I have noted down in coloumn B. Here is a brief example of a sample text string and the list of items:
    Column A:
    "Agricultural activities in Vietnam generate about 62milliontonnes of biomass (rice straw, rice husk, bagasse, corn cob, corn stover, etc.) annually. In this work, four different types of biomass from Vietnam, namely rice straw, rice husk, factory bagasse, and corn cob, have been studied as potential raw materials to produce bio-oil by fast pyrolysis technology. Test runs were conducted in a fluidized-bed reactor at a temperature of 500°C and residence time less than 2s. Size and moisture content of the feed were less than 2mm and 2%, respectively. It was found that yields of bio-oil as a liquid product obtained from pyrolysis of these feedstocks were more than 50% and that obtained from the bagasse was the highest. Bio-oil quality from Vietnamese biomass resources satisfies ASTM D7544-12 standard for pyrolysis liquid biofuels. These results showed the potential of using biomass in Vietnam to produce bio-oil which could be directly used as a combustion fuel or upgraded into transportation fuels and chemicals"

    Column B:
    List of items:
    straw
    stover
    leaves
    shell
    peel
    cob
    piassava
    stalk
    root
    tuber

    I have used the following formula that works, but it extracts only the first matching in the text string namely 'straw'. But I wish to also obtain any other names that are present in the list of items and display them comma seperated.
    =IFERROR(INDEX($B$1:$B$86,MATCH(1,COUNTIF($A1,"*"&$B$1:$B$86&"*"),0)),"")


    Looking forward to a response.
    Thanks in Advance,


    Ankit

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: How to extract a particular word(s) from a cell in excel that matches a list of values

    How many items do you have in column B?

    Pete

  3. #3
    Registered User
    Join Date
    12-09-2016
    Location
    U.K
    MS-Off Ver
    Windows 7
    Posts
    4

    Re: How to extract a particular word(s) from a cell in excel that matches a list of values

    I have just posted a sample of a list of items from one list labelled 'fuel crops'- I actually have 9 such lists each with varying number of items. The list with the largest number of items has 135 entries.
    Hope this answers your question?

    Ankit

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: How to extract a particular word(s) from a cell in excel that matches a list of values

    In that case I don't think a formula solution would be suitable - it would be very "clunky". Perhaps you should be asking in the VBA forum, and it would help if you attached a sample Excel workbook.

    Pete

  5. #5
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: How to extract a particular word(s) from a cell in excel that matches a list of values

    Hi Ankit

    What version of your Office?
    Try this (from Office 2010) in B2 and copy forward
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    where A2 have your text and D5:D14 have the list of items.

  6. #6
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,914

    Re: How to extract a particular word(s) from a cell in excel that matches a list of values

    Try:
    Please Login or Register  to view this content.
    Use:

    =Extract_word(A1,$B$1:$B$86)
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-09-2016
    Location
    U.K
    MS-Off Ver
    Windows 7
    Posts
    4

    Re: How to extract a particular word(s) from a cell in excel that matches a list of values

    @Pete: Thank you for your reply and will keep that in mind for future posts.

    @José: Thanks for the formula- it worked and looks to be the most suitable if I want the results in seperate cells and not comma-seperated.

    @Phuocam: Thank you for the code- worked really well. Just one issue still remains- it isnt case sensitive and so its not able to pick up the names which start with a capital letter in the text string.
    For example it picks up 'straw' but not 'Straw'.
    Any idea how I can adapt the code to include this?

    Ankit

  8. #8
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,914

    Re: How to extract a particular word(s) from a cell in excel that matches a list of values

    Change:

    If InStr(Str, Cll.Value) > 0 Then

    To:

    If InStr(LCase(Str), LCase(Cll.Value)) > 0 Then


  9. #9
    Registered User
    Join Date
    12-09-2016
    Location
    U.K
    MS-Off Ver
    Windows 7
    Posts
    4

    Re: How to extract a particular word(s) from a cell in excel that matches a list of values

    Perfect!
    Thank you very much

  10. #10
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,914

    Re: How to extract a particular word(s) from a cell in excel that matches a list of values

    You are welcome.

+ 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. Extract exel cell values into a word document
    By Theofan21 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2016, 09:22 AM
  2. extract email address from the cell if it matches one from the list
    By mumsys in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-20-2014, 10:34 AM
  3. Replies: 15
    Last Post: 05-28-2014, 05:57 AM
  4. Replies: 5
    Last Post: 10-02-2012, 10:29 AM
  5. Extract headers from multiple Word files and list them in Excel
    By Towanda in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-30-2012, 12:09 PM
  6. [SOLVED] find word(s) within text string that matches a list of keywords
    By ecc34_11 in forum Excel General
    Replies: 10
    Last Post: 07-11-2012, 06:04 AM
  7. [SOLVED] find first word within text string that matches from a list of keywords
    By exclusivebiz in forum Excel General
    Replies: 5
    Last Post: 04-13-2012, 03:29 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