+ Reply to Thread
Results 1 to 7 of 7

Search for a word from a sentence....

  1. #1
    Registered User
    Join Date
    08-24-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Search for a word from a sentence....

    Hi Experts,

    Struggling hard to get below requirement done. Please help. Below is my data

    Column A

    ABCD PRIVATE LIMITED FED
    ABCD PRIVATE LIMITED
    PREMIER
    ABCD PRIVATE LIMITED LONDEN BRANCH
    ABCD INTERNATIONAL FIN
    HELLO
    ABCD
    PQRS

    Column B
    ABCD
    PREMIER

    Above being my data in column A and B. I need to search each word in a cell in column A and match to each cell in column B. If any one word matches then i need to print Value of the cell in column A in column C

    Below is output required

    Column C
    ABCD PRIVATE LIMITED FED
    ABCD PRIVATE LIMITED
    PREMIER
    ABCD PRIVATE LIMITED LONDEN BRANCH
    ABCD INTERNATIONAL FIN
    N/A
    ABCD
    N/A

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

    Re: Search for a word from a sentence....

    Try this in C1:

    =IF(OR(ISNUMBER(SEARCH(B1,A1)),ISNUMBER(SEARCH(B2,A1))),A1,"n/a")

    Then copy down.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    08-24-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Search for a word from a sentence....

    Not accurate. Below is the result.

    Column C

    IFIC BANK LIMITED FEDERATION
    n/a
    PREMIER
    IFIC BANK LIMITED MOTIJHEEL BRANCH
    IFIC INTERNATIONAL FINANCE
    IFIC
    ICICI


    The formula =IF(OR(ISNUMBER(SEARCH(B1,A1)),ISNUMBER(SEARCH(B2,A1))),A1,"n/a") is searching the word from Column B against Column A. I think i my case; i need to take each word in A1 and search for the word in Column B if any one word matches the i need to print the same in Column C.

    Please correct if my explanation is wrong

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

    Re: Search for a word from a sentence....

    You said before:

    If any one word matches then i need to print Value of the cell in column A in column C
    which is what the formula seems to be doing. Are you now saying that you want the matching word (from column B) to appear in column C ?

    Pete

  5. #5
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Search for a word from a sentence....

    Try this small macro:

    Please Login or Register  to view this content.

    Macros are very easy to install and use:

    1. ALT-F11 brings up the VBE window
    2. ALT-I
    ALT-M opens a fresh module
    3. paste the stuff in and close the VBE window

    If you save the workbook, the macro will be saved with it.

    To remove the macro:

    1. bring up the VBE window as above
    2. clear the code out
    3. close the VBE window

    To use the macro from Excel:

    1. ALT-F8
    2. Select the macro
    3. Touch RUN

    To learn more about macros in general, see:

    http://www.mvps.org/dmcritchie/excel/getstarted.htm
    Gary's Student

  6. #6
    Registered User
    Join Date
    08-24-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Search for a word from a sentence....

    Amazing!!! It worked Jakobshavn. Thanks for your favor

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Search for a word from a sentence....

    If you are satisfied with the solution(s) provided, please remember to mark your thread as Solved.

    New quick method:
    Select Thread Tools (above first post on page) -> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word "Title" you will see a dropdown with the words "No prefix".
    Change to "Solved"
    Click Save

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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