• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Compare words in text to comma separated list of terms

mdavid

Member
Hi I'm looking for a vba solution for the following:
Sheet1 Col A: Group Name
Col B: list of comma separated terms (for this Group)


Sheet2 Col A: text string
Col B: Group Name


I need to loop thru all the Groups in Sheet 1 and check if any of the terms in Sheet1 ColB appear in the text in Sheet2 Col A, if a match is found then copy the Group Name (Sheet1 ColA) to Sheet2 ColB and continue with the next cell in Sheet2 Col A.
What I have so far is:

Code:
For each cell in Sheet2ColA
    For each Group in Sheet1ColA
       If  (word in Sheet2ColA  is found in Sheet1ColB) Then
            Copy Sheet1ColA (Group Name) to Sheet2ColB
            Exit For
       End If
   Next Group
Next  cell in Sheet2ColA

Need help to write the VBA
Thanks
David
 
To save us guessing/assuming wrongly about all sorts of things (and to save us some work), could you attach a simple file with your data setup?
 
Hi !

As initial post is not clear as it should be, better is to join
before & after samples worksheets respecting real layout ...
 
Back
Top