MUST BE A WAY!!! Returning Multiple Results Based on a Single Criteria and Combining Them HELP!!1

kescco

Board Regular
Joined
Sep 14, 2009
Messages
174
Okay, I am trying to explain this simply as I can in hopes someone here can help.

In need Excel to search for DOG in Sheet 2 Column A and in Sheet 1 Column B list a combined list of all names it finds in Sheet 2 Column B. An example is as shown below, in Sheet 1 Column B all names I am looking for are listed.

Is this a MATCH, INDEX, CONCATENATE combination? I appreciate you help. I have racked my brains on this one to no avail.


Sheet 1


ANIMALTYPESLIFE
DogCollie, Poodle, Labrador10 Yrs
Cat 8 Yrs
Fish3 Yrs

<tbody>
</tbody>


Sheet 2

ANIMALCommon NameRARE??
DogCollie No
CatSiameseNo
FishGold No
Dog Poodle No
CatCallico No
FishGuppie No
DogLabrador No
CatBurmeseNo
FishTynese TroutYes

<tbody>
</tbody>
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Try this user-defined function. To implement ..

1. Right click the sheet name tab and choose "View Code".

2. In the Visual Basic window use the menu to Insert|Module

3. Copy and Paste the code below into the main right hand pane that opens at step 2.

4. Close the Visual Basic window.

5. Enter the formula as shown in the screen shot below and copy down.

6. If using Excel 2007 or later your workbook will need to be saved as a macro-enabled workbook (*.xlsm)
Rich (BB code):
Function MakeList(s As String, r As Range) As String
  Dim a
  Dim rws As Long, i As Long
  Dim t  As String
  
  a = r.Value
  rws = UBound(a, 1)
  For i = 1 To rws
    If a(i, 1) = s Then t = t & ", " & a(i, 2)
  Next i
  MakeList = Mid(t, 3)
End Function

Excel Workbook
ABC
1ANIMALCommon NameRARE??
2DogCollieNo
3CatSiameseNo
4FishGoldNo
5DogPoodleNo
6CatCallicoNo
7FishGuppieNo
8DogLabradorNo
9CatBurmeseNo
10FishTynese TroutYes
Sheet2




Excel Workbook
ABC
1ANIMALTYPESLIFE
2DogCollie, Poodle, Labrador10 Yrs
3CatSiamese, Callico, Burmese8 Yrs
4FishGold, Guppie, Tynese Trout3 Yrs
Sheet1
 
Last edited:
Upvote 0
Here is a link to a mini-blog article of mine which includes a function that can do what you want...

LookUp Value and Concatenate All Found Results

The function contained in the article gives you the ability to specify the delimiter, restrict the returned concatenation to unique values only (each concatenated item appears only once in the concatenation) and restrict the search to an exact match (by letter casing).
 
Upvote 0
i appreciate the help. I am going to try the code now and see how it works.

Please note the tables were just an example, my actual Worksheets are much large with much more detail but if I can get the code correct, I can modify it for my larger sheets.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,739
Members
448,989
Latest member
mariah3

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