Guest User

Untitled

a guest
Oct 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Function CustomVLookup(ByVal Lookup_Val As Range, Table_Array As Range, ColIndex As Integer) As String
  2. Dim x, dict
  3. Dim i As Long
  4. x = Table_Array.Value
  5. Set dict = CreateObject("Scripting.Dictionary")
  6. For i = 1 To UBound(x, 1)
  7. If x(i, 1) = Lookup_Val.Value Then
  8. dict.Item(x(i, ColIndex)) = ""
  9. End If
  10. Next i
  11. If dict.Count > 0 Then
  12. CustomVLookup = Join(dict.keys, ", ")
  13. Else
  14. CustomVLookup = ""
  15. End If
  16. End Function
  17.  
  18. =CustomVLookup(A2,F2:G25,2)
Add Comment
Please, Sign In to add comment