Try this small macro:
Sub GatherData()
Dim Na As Long, Nb As Long, L As Long
Dim vB As String, K As Long, J As Long
Na = Cells(Rows.Count, "A").End(xlUp).Row
Nb = Cells(Rows.Count, "B").End(xlUp).Row
For L = 1 To Na
Cells(L, "C").Clear
Next
For L = 1 To Na
Cells(L, "C").Value = "N/A"
ary = Split(Cells(L, "A"), " ")
For K = 1 To Nb
vB = Cells(K, "B").Value
For J = LBound(ary) To UBound(ary)
If ary(J) = vB Then
Cells(L, "C").Value = Cells(L, "A").Value
End If
Next
Next
Next
End Sub
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
Bookmarks