Option Explicit
Option Compare Text
Function FINDMATCH(LookupVal As range, rng As range, ColIndex As Integer) As String
Application.Volatile True
Dim r As range, sMatch As String
For Each r In rng
If r = LookupVal Then
sMatch = sMatch & r.Offset(, ColIndex).Text & ", "
End If
Next r
sMatch = Left(sMatch, Len(sMatch) - 2)
FINDMATCH = sMatch
End Function
|