Vlookup to Return Multiple entries ...... HELP!!!!!!

TD Rich

Active Member
Joined
Aug 10, 2010
Messages
343

Hello,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p></o:p>
I am looking for a way to have the vlookup function (or an equivalent) return multiple entries.<o:p></o:p>
<o:p></o:p>
I have a name in cell A1 and I want to search for that name in column A on another sheet and then return the corresponding value in column C every time this name is found.<o:p></o:p>
<o:p></o:p>
Any help would be greatly appreciated as this has been driving me mad for hours now!!!!!!!!! :eek:<o:p></o:p>
<o:p></o:p>
Over to you Mr.Excel !!<o:p></o:p>
<o:p></o:p>
Cheers,<o:p></o:p>
<o:p></o:p>
Rich.<o:p></o:p>
 

TD Rich

Active Member
Joined
Aug 10, 2010
Messages
343
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p> </o:p>
Hello sulakvea,<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
<o:p> </o:p>
Yes, although I am very much a beginner when it comes to VBA I have been using it for this project (mostly by recording macros and the copying / editing / pasting other bits of VBA code that I have managed to alter to suit what I am trying to achieve). <o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
<o:p> </o:p>
Cheers,<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
<o:p> </o:p>
Rich.<o:p></o:p>
 

sulakvea

Well-known Member
Joined
Jul 2, 2008
Messages
994
although, one way would be to just write this in C1, and copy down. keep the @ signs where i placed them:

=if(A1=$A$1,A1,"")

here's a VBA equivalent:

Code:
Sub FindAllValues()

i = 1
With Sheet1.Range("A:A")
 Set c = .Find(Sheet1.Range("A1"), LookIn:=xlValues, lookat:=xlWhole)
 If Not c Is Nothing Then
  firstAddress = c.Address
  Do
   c.Offset(0, 2).Value = c.Value
   i = i + 1
   Set c = .FindNext(c)
  Loop While Not c Is Nothing And c.Address <> firstAddress
 End If
End With
  
End Sub
 

TD Rich

Active Member
Joined
Aug 10, 2010
Messages
343
Thanks sulakvea,

Really apreciate that. Thats a massive help!

Cheers,

TD Rich
 

TD Rich

Active Member
Joined
Aug 10, 2010
Messages
343
<TABLE style="WIDTH: 233pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=310 border=0 x:str><COLGROUP><COL style="WIDTH: 124pt; mso-width-source: userset; mso-width-alt: 6034" width=165><COL style="WIDTH: 56pt; mso-width-source: userset; mso-width-alt: 2706" width=74><COL style="WIDTH: 53pt; mso-width-source: userset; mso-width-alt: 2596" width=71><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD class=xl24 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; WIDTH: 124pt; BORDER-BOTTOM: #d4d0c8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" width=165 height=17>



Sheet2

A
tonwship Resources Ltd.
</TD><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; WIDTH: 56pt; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent" width=74>





B
mr man
</TD><TD class=xl25 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; WIDTH: 53pt; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent" align=right width=71 x:num>





C
2.00
</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl24 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>tonwship Resources Ltd.</TD><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent">mrs woman</TD><TD class=xl25 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent" align=right x:num>3.00</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl24 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>tonwship Resources Ltd.</TD><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent">mr maple</TD><TD class=xl25 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent" align=right x:num>4.00</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD class=xl24 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17>stupid macro company</TD><TD style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent">mr canada</TD><TD class=xl25 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; BORDER-BOTTOM: #d4d0c8; BACKGROUND-COLOR: transparent" align=right x:num>5.00</TD></TR></TBODY></TABLE>



Sheet1

A
<TABLE style="WIDTH: 124pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=165 border=0 x:str><COLGROUP><COL style="WIDTH: 124pt; mso-width-source: userset; mso-width-alt: 6034" width=165><TBODY><TR style="HEIGHT: 15pt" height=20><TD class=xl24 style="BORDER-RIGHT: #d4d0c8; BORDER-TOP: #d4d0c8; BORDER-LEFT: #d4d0c8; WIDTH: 124pt; BORDER-BOTTOM: #d4d0c8; HEIGHT: 15pt; BACKGROUND-COLOR: transparent" width=165 height=20>tonwship Resources Ltd.</TD></TR></TBODY></TABLE>

What i am looking to do is have excel look at text in Cell A1 on sheet1 and then look for corresponding entries in column A on sheet 2. Then for every corresponding entry it finds on sheet 2 return the value in column B of that sheet to Cell B1 on sheet 1. Basicly Vlookup but returning not just the first entry that it finds but all entries that match.

Cheers,

Rich.
 

Forum statistics

Threads
1,082,283
Messages
5,364,268
Members
400,787
Latest member
bs04c

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top