Hi all,
I have a spreadsheet that has 3 columns of data. I need to match results from 2 of the columns and return all the results from the corresponding 3rd column into a single cell. I have found some code that does this for a single search but I don't know how to expand this to search in an additional column. This code is below. Please could someone help?
'Multiple lookup and no repeat function, finds and lists all unique numbers in row form Function MultipleLookupNoRept(Lookupvalue As String, LookupRange As Range, ColumnNumber As Integer) Dim xDic As New Dictionary Dim xRows As Long Dim xStr As String Dim i As Long On Error Resume Next xRows = LookupRange.Rows.Count For i = 1 To xRows If LookupRange.Columns(1).Cells(i).Value = Lookupvalue Then xDic.Add LookupRange.Columns(ColumnNumber).Cells(i).Value, "" End If Next xStr = "" MultipleLookupNoRept = xStr If xDic.Count > 0 Then For i = 0 To xDic.Count - 1 xStr = xStr & xDic.Keys(i) & "," Next MultipleLookupNoRept = Left(xStr, Len(xStr) - 1) End If End Function
Bookmarks