+ Reply to Thread
Results 1 to 7 of 7

Find some words in a string

  1. #1
    Registered User
    Join Date
    07-15-2014
    Location
    London, England
    MS-Off Ver
    Office 2010
    Posts
    7

    Lightbulb Find some words in a string

    Hi all,

    Let me explain you the problem I am facing. I have a list of words, let's say for example: "butter", "honey". I would like Excel to extract, from a cell, all the words from the list that are used in this cell. Let's have an example:

    I love butter but not honey butter honey
    I don't like butter butter
    I like cherries
    I always eat honey, it's the best food ever. honey


    Have you got a solution with a formula or a macro ?

    Best regards,

    Larry.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Find some words in a string

    A small UDF does the trick:
    Please Login or Register  to view this content.

    Use as:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    07-15-2014
    Location
    London, England
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Find some words in a string

    Thank you very much that's great ! Now, instead of writing the list of words in the VBA code, I would like to refer to a specific cell (let's say A1) in an other Excel file (let's say example.xlsx in the same folder) that would contain the following value: " "honey", "butter" "

    How can I do it ? Thanks

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Find some words in a string

    try:
    Please Login or Register  to view this content.
    Use a cell in this workbook to link to the list of words in another workbook, if necessary, and reference the local range in the function (commented line).

  5. #5
    Registered User
    Join Date
    07-15-2014
    Location
    London, England
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Find some words in a string

    Great ! Thank you very much for your help

  6. #6
    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: Find some words in a string

    Quote Originally Posted by larrygoldstein View Post
    Thank you very much that's great ! Now, instead of writing the list of words in the VBA code, .....
    How can I do it ? Thanks
    Hello Larry,

    Just an observation which I hope you'll accept in the way it's intended. When posing a question try to make sure all facts or requirements are known in the first post. This avoids people needing to revisit the task. On this occasion I guess it wasn't too onerous but I've seen threads when the final requirement for a real world workbook is far removed from an example and simplified original workbook.
    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.

  7. #7
    Registered User
    Join Date
    07-15-2014
    Location
    London, England
    MS-Off Ver
    Office 2010
    Posts
    7

    Re: Find some words in a string

    Hello Richard,

    No problem, you do well to remind people the rules.

+ 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. Replies: 1
    Last Post: 07-02-2014, 12:02 PM
  2. Find, List and Count All Words within a Text String
    By TheDrMrsSmith in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-28-2014, 11:07 PM
  3. [SOLVED] Find text string exist in cell from keys words
    By johnodys in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-11-2013, 01:56 AM
  4. Which function to find a words in word string and return them
    By majo. in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-27-2013, 09:08 AM
  5. Replies: 4
    Last Post: 04-27-2012, 06:38 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