Give this User Defined Function a try...
Function CustomVLookup(ByVal Lookup_Val As Range, Table_Array As Range, ColIndex As Integer) As String
Dim x, dict
Dim i As Long
x = Table_Array.Value
Set dict = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(x, 1)
If x(i, 1) = Lookup_Val.Value Then
dict.Item(x(i, ColIndex)) = ""
End If
Next i
If dict.Count > 0 Then
CustomVLookup = Join(dict.keys, ", ")
Else
CustomVLookup = ""
End If
End Function
And then use it on the sheet like below...
=CustomVLookup(A2,F2:G25,2)
Where A2 is the cell which contains the lookup value, F2:G25 is the table array and 2 is the column index which is 2 i.e. column G in this case.
Edit: The above function will return all the unique values which belong to the lookup value. If you want to return all the values not unique only, you will need a different approach. Let me know if that is the case.
COUNTIF($A$2:A2,A2)
with the Index + Match formula found here How To Vlookup Find The First, 2nd Or Nth Match Value In Excel . The COUNTIF formula I provided is based off the running total pattern: Calculate a running total of a column of cells in Excel – user6432984