Excel VBA to search for list of keywords in a cell given a value in another cell and then make changes to a third cell
<p>UPDATE: UPDATE: Thank you all for your initial contribution, now I have worked through the code but I am stuck. It gives me an error ! plus I am not sure if my code will do the task needed .. here is the edited description :=</p>

<p>I have a list of guests whom each eats a certain type of vegetables. For instance John,Smith eats potato and tomato. While Bill,Peter eats Carrots,Onions. I have created a list along with keywords that looks like this </p>

<p><a href="https://i.stack.imgur.com/nGsOr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nGsOr.png" alt="enter image description here"></a></p>

<p>Now, I receive a data extract that has a list of names along with a free text description of the food they ate. Here is what i get</p>

<p><a href="https://i.stack.imgur.com/UECwv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UECwv.png" alt="enter image description here"></a></p>

<p>Unfortunately, I get the names in a format that I do not want like John,Smith (Primary Customer) and I want excel to add the vegetable they ate given it is written in the description. For example, John,Smith (Primary Customer) has the description as: "he had French fries and wedges"  and since the description contains a keyword listed in my initial table for the same indivdual then his name will be changed from John,Smith (Primary Customer) to John,Smith-Potato (Primary Customer).</p>

<p>I want excel to check if the name exists in the first table first and then look through the description to find any keywords. This will make sure if the name at hand is not contained in my list then excel will not spend time looking for keywords. Also, if no keyword found then do not edit the name.</p>

<p>this is what I expect to get</p>

<p><a href="https://i.stack.imgur.com/znWZE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/znWZE.png" alt="enter image description here"></a></p>

<p>With the help of you guys I was able to edit this code but it still gives me error and I am not sure if it does what I wanted it to do. Any ideas where to go from here?</p>

<p>here is the code :</p>

<pre><code>Option Explicit
Sub homework()
Dim ws1 As Worksheet, ws2 As Worksheet, keywords() As String, lastRow As Integer, lastRow2 As Integer, c As Variant, x As Integer, y As Integer, k As Variant, cel As Range, descript As Range
Dim SrchRng As Range
Dim SrchStr As Variant
Set ws1 = Worksheets("Sheet2") 'the sheet that contains keywords which is the sheet i will make
Set ws2 = Worksheets("Sheet1") 'the sheet that contains description of food
lastRow = ws1.Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, searchdirection:=xlPrevious).Row
lastRow2 = ws2.Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, searchdirection:=xlPrevious).Row
Set SrchRng = Worksheets("Sheet2").Range("A1:A1000")
Set descript = ws2.Range("C2:C" &amp; lastRow2)
For x = 2 To lastRow ' this is to the last row in the database i will create
    keywords = Split(ws1.Cells(x, 3), ",")
    For Each k In keywords
        For Each cel In descript
        For y = 2 To lastRow2
        Do
        SrchStr = Left(ws2.Cells(y, 2), InStr(ws2.Cells(y, 2), " (") - 1)
        Set c = SrchRng.Find(SrchStr, LookIn:=xlValues)
            If Not SrchRng.Find(SrchStr, LookIn:=xlValues) Is Nothing And InStr(ws2.Cells(y, 3), k) &lt;&gt; 0 Then
                ws2.Cells(y, 2).Value = ws1.Cells(x, 1).Value &amp; "-" &amp; ws1.Cells(x, 2).Value
                SrchStr = Nothing
                Exit Do
                End If
        Loop While Not c Is Nothing
            Next y
        Next cel
    Next k
Next x
End Sub
</code></pre>