VLookups

K

Khun John

I need a VLookups type macro for Worksheet2!ColumnB below to return the
values shown in the example. It matches the array Worksheet1A1:B4 with the
date shown in Worksheet2!ColumnA and returns multiple occurrences. I've
tried Alan Beban's solution but cannot get it to work.

Worksheet1 Worksheet2
A B A B
1 3rd July 03 11 1 1st July 03 14
2 4th July 03 12 2 2nd July 03
3 3rd July 03 13 3 3rd July 03 11, 13
4 1st July 03 14 4 4th July 03 12

Can Alan or anyone else help?
Thanks
John
 
D

Dan E

Try this

Public Function MultiLookUp(Find As Range, InRange As Range, Column As
Integer) As String
For Each Cell In InRange
If Cell.Value = Find.Value Then
output = output & Cell.Offset(0, Column - 1).Value & ", "
End If
Next
MultiLookUp = Left(output, Len(output) - 2)
End Function

Dan E
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top