Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Lookup to return multiple results in one cell

Name # of cats
Jack X123
Jack X224
Lisa X123
Ben Z324
Derek X123
Derek Z324

Above is my example data set.

Ideally what I would like to do is be able to have concatonated
results on one line based off a lookup.

E.g.

I look for Jack and the formula returns: "X123, X224" in one cell.

Is there anything out there that can do that?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Lookup to return multiple results in one cell

Function MyLookup(LookFor, FindCol As Range, GetCol As Range) As
String
For Each c In FindCol
If LookFor = c Then
If MyLookup = "" Then
MyLookup = Cells(c.Row, GetCol.Column)
Else
MyLookup = MyLookup & ", " & Cells(c.Row, GetCol.Column)
End If
End If
Next c
End Function

You may want to add some error checking.

Hth,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Lookup to return multiple results in one cell

On Apr 12, 1:21 pm, "merjet" wrote:
Function MyLookup(LookFor, FindCol As Range, GetCol As Range) As
String
For Each c In FindCol
If LookFor = c Then
If MyLookup = "" Then
MyLookup = Cells(c.Row, GetCol.Column)
Else
MyLookup = MyLookup & ", " & Cells(c.Row, GetCol.Column)
End If
End If
Next c
End Function

You may want to add some error checking.

Hth,
Merjet


Hello, I know near to nothing about VBA, would you tell me how to use
your macro?
Thanks in advance,
Armando

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to return multiple results in a cell Vinod[_2_] Excel Discussion (Misc queries) 5 May 28th 08 06:34 AM
lookup single value in one sheet, return multiple results from theother sheet Chuck[_3_] Excel Worksheet Functions 1 April 4th 08 06:17 AM
lookup one value in list and return multiple results ORLANDO V[_2_] Excel Worksheet Functions 2 January 29th 08 09:49 PM
V lookup with 2 criteria to return results for multiple columns JenL Excel Worksheet Functions 2 September 20th 07 10:04 PM
Return Multiple Results with Lookup Josh O. Excel Worksheet Functions 1 February 4th 05 08:07 PM


All times are GMT +1. The time now is 03:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"