+ Reply to Thread
Results 1 to 9 of 9

Searching for multiple keywords in multiple sources of text

  1. #1
    Registered User
    Join Date
    01-12-2022
    Location
    netherlands
    MS-Off Ver
    365
    Posts
    7

    Searching for multiple keywords in multiple sources of text

    Hello everyone,

    I have an interesting problem that I previously tried to combat with normal formula's but I think having a VBA macro is going to be way faster.

    I have text in 4 different columns D:G on sheet "Rawdata input" and a big changing keyword list in sheet "Keywords" that starts at G5. I would like to run a lookup per column for every synonym and then return all synonyms concatinated per column in columns A:D in sheet "Output". Also every synonym has a main keyword above the synonym list in G2. I also would like to return the main keyword in column E on the output sheet. So if column D has 4 synonyms returns I would like to concatinate them in column A on the output sheet and if column E has 2 returns I would like to concatinate those in Column B etc. etc. Once keywords lookup is done-all keywords should be separated by symbol ",".

    So as follows:
    - Column D:G on sheet "Rawdata input" contains of large text
    - Column G5.currentregion on sheet "keywords" contain the always changing synonym list
    - Column G2 on sheet "keywords" contain the main keywords
    - Column A:D on sheet "output" should return synonyms per concatinated per column with a "," as separator. So synonyms from D on the rawdata list go to column A on the output list, E to B, F to C and G to D.
    - Column E on sheet "output" should return the main keywords found

    I really hope i made myself clear as it might be really confusing, thats why I made a sample sheet:

    thank you for any help you can provide!

    Bart
    Attached Files Attached Files
    Last edited by Bart..; 01-13-2022 at 07:12 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,980

    Re: How do I search for keywords in a large text and then return that keyword if found

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, relevant cells highlighted and a few explanatory notes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    01-12-2022
    Location
    netherlands
    MS-Off Ver
    365
    Posts
    7

    Re: How do I search for keywords in a large text and then return that keyword if found

    Thank you! added it in now
    Last edited by AliGW; 01-12-2022 at 10:34 AM. Reason: PLEASE don't quote unnecessarily!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,980

    Re: How do I search for keywords in a large text and then return that keyword if found

    Thread moved to the VBA section. Please do NOT open duplicate threads (see the forum rules). Thank you.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Searching for multiple keywords in multiple sources of text

    One way
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-12-2022
    Location
    netherlands
    MS-Off Ver
    365
    Posts
    7

    Re: Searching for multiple keywords in multiple sources of text

    Thank you so much jindon !! it blows my mind that you can do this. I cant even navigate an forum properly and you did this. Thats insane


    Thank you so much again!

    Original Post:

    Thank you so much jindon !! it blows my mind that you can do this.

    I had one problem though (which is my mistake for not saying it). Sometimes the cell with text is empty, now it gives an error. Is there an easy way to fix this?

    I get a typ mismatch error on this part:

    Please Login or Register  to view this content.
    Please do not post-edit posts in such a way that subsequent posts make no sense. Thank you.
    Last edited by AliGW; 01-13-2022 at 09:37 AM.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,980

    Re: Searching for multiple keywords in multiple sources of text

    @Bart

    I've added code tags for you, which are required when you post code, please.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Searching for multiple keywords in multiple sources of text

    Bart

    Thanks for the rep.
    I down loaded the file that I uploaded and run, but it is very slow. (When I tested before I upload, it was fast enough...)
    This one should be faster...
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    01-12-2022
    Location
    netherlands
    MS-Off Ver
    365
    Posts
    7

    Re: Searching for multiple keywords in multiple sources of text

    Hey,

    Thanks again! this does indeed run faster, super helpfull ones again :D

+ 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: 4
    Last Post: 07-24-2020, 10:23 AM
  2. Formula to search text string for an array of keywords and return given value
    By JulietLovesExcel in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 09-08-2019, 06:40 PM
  3. [SOLVED] See if string contains any of the keywords on a table and return nickname of that keyword
    By speedyacct in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-31-2014, 12:02 AM
  4. [SOLVED] VBA looking for multiple keywords and return concatenated keywords, that were found
    By Kpacu007 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-10-2014, 06:03 AM
  5. Column keyword search using list of keywords
    By tshrader in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-28-2011, 03:46 PM
  6. Replies: 2
    Last Post: 11-24-2010, 05:44 PM
  7. Keyword search, several keywords
    By Doman in forum Excel General
    Replies: 1
    Last Post: 07-24-2006, 06:05 AM

Tags for this Thread

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