Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 414
Default Lookup to return multiple data from the same column

Hi,
I'm trying to add a column on a new worksheet that looks up from data from
an existing worksheet, which looks like this:
Company Projects
A. Mole b10
A. Mole b15
A. Mole b13
J. Beam b12
E. Potter b11
E. Potter b14

I would like to be able to find ALL the projects done by "A. Mole" and
return the data into ONE cell.
And so on so that the new sheet would look like this:
Company Project
A. Mole b10, b15, b13
J. Beam b12
E. P otter b11, b14

If anybody can help i'd be extremely grateful.
Cheers Andy

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 964
Default Lookup to return multiple data from the same column

Not possible, you would need as many cells as there are projects done
by "A. Mole"

--


Regards,


Peo Sjoblom

"Andy" wrote in message
...
Hi,
I'm trying to add a column on a new worksheet that looks up from data from
an existing worksheet, which looks like this:
Company Projects
A. Mole b10
A. Mole b15
A. Mole b13
J. Beam b12
E. Potter b11
E. Potter b14

I would like to be able to find ALL the projects done by "A. Mole" and
return the data into ONE cell.
And so on so that the new sheet would look like this:
Company Project
A. Mole b10, b15, b13
J. Beam b12
E. P otter b11, b14

If anybody can help i'd be extremely grateful.
Cheers Andy



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Lookup to return multiple data from the same column

Try the following User Defined Function:

Function listum(s As String, tabl As Range) As String
Dim v As String
listum = ""
n = tabl.Rows.Count
For i = 0 To n - 1
v = tabl(1).Offset(i, 0).Value
If v = s Then
listum = listum & "," & tabl(1).Offset(i, 1).Value
End If
Next
listum = Right(listum, Len(listum) - 1)
End Function

With your data in A2 thru B7, the fomula:

=listum("A.Mole",A2:B7)
will return:
b10,b15,b13
all in a single cell


UDFs are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the UDF will be saved with it.

To use the UDF from the normal Excel window, just enter it like a normal
Excel Function

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about UDFs, see:

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx




--
Gary''s Student - gsnu200810


"Andy" wrote:

Hi,
I'm trying to add a column on a new worksheet that looks up from data from
an existing worksheet, which looks like this:
Company Projects
A. Mole b10
A. Mole b15
A. Mole b13
J. Beam b12
E. Potter b11
E. Potter b14

I would like to be able to find ALL the projects done by "A. Mole" and
return the data into ONE cell.
And so on so that the new sheet would look like this:
Company Project
A. Mole b10, b15, b13
J. Beam b12
E. P otter b11, b14

If anybody can help i'd be extremely grateful.
Cheers Andy

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 414
Default Lookup to return multiple data from the same column

That was exactly what i was looking for gary thanks. However the example i
gave was simplified. Instead of the data being returned from the 2nd column
i actually need it from the third column. How would i changed the UDF to
suit this?

"Gary''s Student" wrote:

Try the following User Defined Function:

Function listum(s As String, tabl As Range) As String
Dim v As String
listum = ""
n = tabl.Rows.Count
For i = 0 To n - 1
v = tabl(1).Offset(i, 0).Value
If v = s Then
listum = listum & "," & tabl(1).Offset(i, 1).Value
End If
Next
listum = Right(listum, Len(listum) - 1)
End Function

With your data in A2 thru B7, the fomula:

=listum("A.Mole",A2:B7)
will return:
b10,b15,b13
all in a single cell


UDFs are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the UDF will be saved with it.

To use the UDF from the normal Excel window, just enter it like a normal
Excel Function

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about UDFs, see:

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx




--
Gary''s Student - gsnu200810


"Andy" wrote:

Hi,
I'm trying to add a column on a new worksheet that looks up from data from
an existing worksheet, which looks like this:
Company Projects
A. Mole b10
A. Mole b15
A. Mole b13
J. Beam b12
E. Potter b11
E. Potter b14

I would like to be able to find ALL the projects done by "A. Mole" and
return the data into ONE cell.
And so on so that the new sheet would look like this:
Company Project
A. Mole b10, b15, b13
J. Beam b12
E. P otter b11, b14

If anybody can help i'd be extremely grateful.
Cheers Andy

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Lookup to return multiple data from the same column

A good start to getting the answer to that would be to decide which thread
you are posting in and stick to it or better still don't multiple post at
all.

Mike

"Andy" wrote:

That was exactly what i was looking for gary thanks. However the example i
gave was simplified. Instead of the data being returned from the 2nd column
i actually need it from the third column. How would i changed the UDF to
suit this?

"Gary''s Student" wrote:

Try the following User Defined Function:

Function listum(s As String, tabl As Range) As String
Dim v As String
listum = ""
n = tabl.Rows.Count
For i = 0 To n - 1
v = tabl(1).Offset(i, 0).Value
If v = s Then
listum = listum & "," & tabl(1).Offset(i, 1).Value
End If
Next
listum = Right(listum, Len(listum) - 1)
End Function

With your data in A2 thru B7, the fomula:

=listum("A.Mole",A2:B7)
will return:
b10,b15,b13
all in a single cell


UDFs are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the UDF will be saved with it.

To use the UDF from the normal Excel window, just enter it like a normal
Excel Function

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about UDFs, see:

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx




--
Gary''s Student - gsnu200810


"Andy" wrote:

Hi,
I'm trying to add a column on a new worksheet that looks up from data from
an existing worksheet, which looks like this:
Company Projects
A. Mole b10
A. Mole b15
A. Mole b13
J. Beam b12
E. Potter b11
E. Potter b14

I would like to be able to find ALL the projects done by "A. Mole" and
return the data into ONE cell.
And so on so that the new sheet would look like this:
Company Project
A. Mole b10, b15, b13
J. Beam b12
E. P otter b11, b14

If anybody can help i'd be extremely grateful.
Cheers Andy



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 414
Default Lookup to return multiple data from the same column

I have just figured out how to change it to suit so thanks very much for all
your help. All i need to do now is to figure out how to get rid of the
"#value!" cells!

"Andy" wrote:

Hi,
I'm trying to add a column on a new worksheet that looks up from data from
an existing worksheet, which looks like this:
Company Projects
A. Mole b10
A. Mole b15
A. Mole b13
J. Beam b12
E. Potter b11
E. Potter b14

I would like to be able to find ALL the projects done by "A. Mole" and
return the data into ONE cell.
And so on so that the new sheet would look like this:
Company Project
A. Mole b10, b15, b13
J. Beam b12
E. P otter b11, b14

If anybody can help i'd be extremely grateful.
Cheers Andy

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
LOOKUP and return the column heading for IF/THEN return for False NN Excel Discussion (Misc queries) 1 October 6th 06 11:24 AM
Search Column Data and Return Multiple Values across Row Sam via OfficeKB.com Excel Worksheet Functions 3 September 30th 06 07:50 PM
Lookup in Multiple Columns, Return Multiple Values andy62 Excel Worksheet Functions 3 July 6th 06 02:36 AM
Lookup with multiple value return Mike Quinn, SrA, USAF Excel Worksheet Functions 2 February 15th 05 05:15 PM
Lookup values in a list and return multiple rows of data Amanda L Excel Worksheet Functions 2 December 2nd 04 04:48 PM


All times are GMT +1. The time now is 07:06 PM.

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

About Us

"It's about Microsoft Excel"