Lookup Returning Multiple Values

izabela92

New Member
Joined
Jul 10, 2017
Messages
5
Hello,

Is there a function similar to vlookup that will return multiple values instead of just the first time it appears in a list.

I have the same user submitting multiple files and when I get a report of all files submitted from a given day I want to be able to look up the user by their ID and have it list all of the files names, not just the first one in the list.

Thanks!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
I think that turning your data into a Pivot Table would be the best way to go about it.
 
Upvote 0
Or, if you want to use a custom function, I think this would work. It's set up like a vlookup where the first argument is the thing you are looking up, the second argument is the entire range, and the third argument is the column within that range that you want the return values to come from.

Code:
Function mLookup(Item As Variant, R As Range, Col As Long) As String
Dim AR()
Dim Res As String
AR = R.Value
For i = 1 To UBound(AR)
    If AR(i, 1) = Item Then
        Res = Res & AR(i, Col) & ", "
    End If
Next i
If Len(Res) > 0 Then
    mLookup = Left(Res, Len(Res) - 2)
Else
    mLookup = "#N/A"
End If
End Function
 
Upvote 0

Forum statistics

Threads
1,214,808
Messages
6,121,686
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top