title: Trying to get vb code to accept partial string matches
body: <pre><code>Function SingleCellExtract(LookupValue As String, LookupRange As Range, ColumnNumber As Integer, Char As String)
      Dim I As Long
      Dim xRet As String
      For I = 1 To LookupRange.Columns(1).Cells.Count
          If LookupRange.Cells(I, 1) = LookupValue Then
              If xRet = &quot;&quot; Then
                  xRet = LookupRange.Cells(I, ColumnNumber) &amp; Char
              Else
                  xRet = xRet &amp; &quot;&quot; &amp; LookupRange.Cells(I, ColumnNumber) &amp; Char
              End If
          End If
      Next
      SingleCellExtract = Left(xRet, Len(xRet) - 1)
  End Function
  </code></pre>
  <p>The above code creates a function that allows you to enter a cell you want to match with a series of cells in a column and then allows you to enter the column number you want to return the value from based on the match. It can also return multiple values from that column seperated by a comma. I retrieved this from <a href="https://www.extendoffice.com/documents/excel/3120-excel-return-multiple-values-separated-by-comma.html" rel="nofollow noreferrer">this</a> webpage. Right now, it only returns exact matches to the selected cell, I want to expand it to include partial matches. I have tried editing it to use the Like operator and accept wildcards, but it doesn't seem to work. The selected cell generally contains a string in the form of A9000, P-6000, P-6000-AL. My version still only retrieves that exact same string from the column. If I enter P9000, I'd also like it to retrieve LP9000, A9000, BL-9000-76, PDP 9000, etc just as an example. Does anyone know how I could achieve this using this code or is there a better alternative? Thank you</p>