ashish mehra
Active Member
Hi,
I am using code to get second instance of lookup value.
=vlookupAM(A2,$A$2:$B$20,2)
The requirement is:
formula: =vlookupAM(B2,CHOOSE({1,2},$B$2:$B$20,$A$2:$A$20),2)
Regards,
AM
I am using code to get second instance of lookup value.
=vlookupAM(A2,$A$2:$B$20,2)
Code:
Function vlookupAM(Lookupvalue As String, LookupRange As Range, ColumnNumber As Integer)
Dim i As Long
Dim Result As String
For i = 1 To LookupRange.Columns(1).Cells.Count
If LookupRange.Cells(i, 1) = Lookupvalue Then
Result = Result & " " & LookupRange.Cells(i, ColumnNumber) & ","
End If
Next i
vlookupAM = Left(Result, Len(Result) - 1)
End Function
The requirement is:
formula: =vlookupAM(B2,CHOOSE({1,2},$B$2:$B$20,$A$2:$A$20),2)
Regards,
AM