List of names using Transpose with Vlookup?

Safari Breeze

New Member
Joined
Aug 5, 2011
Messages
7
Hi,
Any help appreciated!
Sheet 2 has a range of vertical data in Columns A & B: 'Class' & 'Names'
Sheet 1 has the 'Class' code in cell:G2 and list of names range from D4

I want a formula which uses the 'Class' code from G2 to return a horizontal list of all names (preferably alphabetically) belonging to that code.

Does anyone know what that formula should be?

My failed attempt is:

(D4)=TRANSPOSE(VLOOKUP(G2,Sheet2!$A2:B50,2,FALSE))

This returns a name from the correct class code, but when I drag the formula (D4) horizontally for more names, I get the same name again, again and again!!!
(Excel 2007)
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
The following formula in Cell D4 will return all the names from Sheet 2 that match the Class value in Cell G2 of Sheet 1. It is an array formula that requires you to press Control-Shift-Enter instead of just Enter. After you copy it across horizontally, it will display blank cells when it runs out of matching names.

Code:
=IFERROR(INDEX(Sheet2!$B$2:$B$50,SMALL(IF(ISERROR(MATCH(Sheet2!$A$2:$A$50,$G$2,0)),FALSE,ROW(Sheet2!$A$2:$A$50)-1),COLUMN(A3))),"")
 
Upvote 0
Thanks MikeWx for reply,

I dont know why I cant get an array to work for this formula, despite pressing Cltr,Shift + Enter. I had to change sheet2 to 'Class Lists', the actual name of sheet.

Is there something I'm missing here?

=IFERROR(INDEX(Class Lists!$B$2:$B$50,SMALL(IF(ISERROR(MATCH(Class Lists!$A$2:$A$50,$G$2,0)),FALSE,ROW(Class Lists!$A$2:$A$50)-1),COLUMN(A3))),"")
 
Upvote 0
Try this
Excel Workbook
AB
1ClassName
2Class AA
3Class BB
4Class CC
5Class DA
6Class AB
7Class BC
8Class CA
9Class DB
10Class AC
11Class BA
12Class CB
13Class DC
14Class AA
15Class BB
16Class CC
17Class DA
18Class AB
19Class BC
20Class CA
21Class DB
22Class AC
23Class BA
24Class CB
25Class DC
Class Lists
Excel 2010

and in sheet 1
Excel Workbook
GHIJKLMN
2Class A
3ABCABC
Sheet1
Excel 2010
#VALUE!
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
 
Upvote 0
Thanks a lot MikeWx and Yahya...those formulas both worked...BRILLIANT...i'll be able to sleep better after that.

Cheers and thanks again!
:)
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

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