
Originally Posted by
Declan.Ryan
this one has headers
Try the below code in standard module
Function GetMatches(LValue As Range, LRng As Range, ResRng As Range) As String
Dim i As Long
For i = 1 To LRng.Cells.Count
If WorksheetFunction.CountIf(LRng, LValue.Value) Then
If LRng.Cells(i).Value = LValue.Value Then
GetMatches = GetMatches & ResRng.Cells(i).Value & " "
End If
End If
Next i
GetMatches = Trim(GetMatches)
End Function
=GetMatches(LookupValue,LookupRange,ResultRange)
In B1 cell
=GetMatches(A1,E1:E12,F1:F12)
Drag it down.
Refer the attached excel for details.
Edit: Protect the range =getmatches(A1,$E$1:$E$12,$F$1:$F$12)
Bookmarks