Lookup and reference issues

davel58

New Member
Joined
Jan 27, 2009
Messages
25
Hi All, i have a connundrum!

let me break it down...

I have 17 lists of names (displayed in columns B, D F, H onwards). I need to assign a number value in a cell next to each of these names from 1-7 (in columns A, C, E, G onwards). this will be manually entered by me.

on a corresponding sheet i would like to have a function that will gather all the names that have a number 1 next to them and transpose them into 1 list. i would like the next column to display the names that have a corresponding 2 next to their name etc etc etc until i get 7 lists.

i am unsure how i can go about this and thank anyone for their help in advance!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hello,

Fill this down 7 cells, then across as needed:

<TABLE style="WIDTH: 383pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=510><COLGROUP><COL style="WIDTH: 383pt; mso-width-source: userset; mso-width-alt: 9325" width=510><TBODY><TR style="HEIGHT: 15.75pt" height=21><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; BACKGROUND-COLOR: #eaf1dd; WIDTH: 383pt; HEIGHT: 15.75pt; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid" class=xl63 height=21 width=510>=VLOOKUP(ROW(A1),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(A1)-2)),2,FALSE)</TD></TR></TBODY></TABLE>
 
Upvote 0
thanks repairman, great formula and it is definitely on the right track!

each list of names contains around 45 names and there will be around 5 "hits" for each number in each list. therefore not all names will have a number assigned to them.

i hope the results will be sorted as follows

List 1
#1 #2 #3
name name name
name name name
etc etc etc

List 2
#1 #2 #3
name name name
name name name
etc etc etc and onwards through 17 lists

the current formula seems to pick up and transpose only those names that have a corresponding #1 next to them and it seems to repeat them as I drag it down further?

i am open to other ways of organising the data as well. it may perhaps be a design fault that is preventing me from getting this to work easily?

thanks again!
 
Upvote 0
It may help to get a better visual of the task. Try the HTML Maker to post a screen shot.

http://www.mrexcel.com/forum/showpos...70&postcount=2

For example, It will post like:


Excel Workbook
ABCDEF
11Joe7Benny2Connie
22Beth6Hal3Karl
33Fannie5Sally4Mac
44Greg4Betty5Lisa
55Harry3Bill6Sue
66Flo2Frank7Jan
77Marg1Alice1Danny
Sheet1
Excel Workbook
ABC
1JoeAliceDanny
2BethFrankConnie
3FannieBillKarl
4GregBettyMac
5HarrySallyLisa
6FloHalSue
7MargBennyJan
Excel 2007 Sheet2

Excel 2007
Cell Formulas
RangeFormula
A1=VLOOKUP(ROW(A1),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(A1)-2)),2,FALSE)
A2=VLOOKUP(ROW(A2),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(A2)-2)),2,FALSE)
A3=VLOOKUP(ROW(A3),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(A3)-2)),2,FALSE)
A4=VLOOKUP(ROW(A4),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(A4)-2)),2,FALSE)
A5=VLOOKUP(ROW(A5),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(A5)-2)),2,FALSE)
A6=VLOOKUP(ROW(A6),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(A6)-2)),2,FALSE)
A7=VLOOKUP(ROW(A7),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(A7)-2)),2,FALSE)
B1=VLOOKUP(ROW(B1),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(B1)-2)),2,FALSE)
B2=VLOOKUP(ROW(B2),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(B2)-2)),2,FALSE)
B3=VLOOKUP(ROW(B3),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(B3)-2)),2,FALSE)
B4=VLOOKUP(ROW(B4),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(B4)-2)),2,FALSE)
B5=VLOOKUP(ROW(B5),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(B5)-2)),2,FALSE)
B6=VLOOKUP(ROW(B6),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(B6)-2)),2,FALSE)
B7=VLOOKUP(ROW(B7),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(B7)-2)),2,FALSE)
C1=VLOOKUP(ROW(C1),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(C1)-2)),2,FALSE)
C2=VLOOKUP(ROW(C2),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(C2)-2)),2,FALSE)
C3=VLOOKUP(ROW(C3),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(C3)-2)),2,FALSE)
C4=VLOOKUP(ROW(C4),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(C4)-2)),2,FALSE)
C5=VLOOKUP(ROW(C5),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(C5)-2)),2,FALSE)
C6=VLOOKUP(ROW(C6),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(C6)-2)),2,FALSE)
C7=VLOOKUP(ROW(C7),OFFSET(Sheet1!$A$1:$B$7,0,(2*COLUMN(C7)-2)),2,FALSE)


Mainly, I am just a bit confused about the result list.
Also will there be several of the same number in the same "Identifier" column?
If so, what results would you expect?
 
Upvote 0
hi repairman, my description has been rather confusing.

see the manual example below of what i am trying to acheive;

identifier sheet;
Excel Workbook
ABCDEF
1List 1List 2List 3
21Joe7Benny2Connie
32Beth6Hal3Karl
43Fannie5Sally4Mac
54Greg4Betty5Lisa
65Harry3Bill6Sue
76Flo2Frank7Jan
87Marg1Alice1Danny
91sean1barry5david
101rory1john5mon
112sam2sarah4will
124bill4liz3ben
134don4penny1colin
143james5jill2sean
152lary5james1nathan
Sheet1
Excel Workbook
ABCDEFG
1Ranking 1Ranking 2Ranking 3Ranking 4Ranking 5Ranking 6Ranking 7
2joebethfanniegregharryflomarg
3seansamjamesbillsallyhalbenny
4rorylarybilldonjillsuejan
5alicefrankkarlbettyjames
6barrysarahbenlizlisa
7johnconniepennydavid
8dannyseanmacmon
9colinwill
10nathan
Excel 2007 the results would then look like the following (i have manually entered them) Sheet2
Excel 2007

does this make more sense?

there will be 7 ranking grades amongst 17 lists of names, each list will have around 45 names in it, however, some names will not have a number assigned to them. as you see above each of the numbers will appear more than once in each list. If i can get this example to work then i will be able to apply it to the actual lists.

very much appreciate your help!
 
Upvote 0
Hello,

How is VBA for you?

If possible, try this.

Press Alt + F11 to open VBEditor
Keystrokes Alt - I - M

Now Paste the below into the module:
(Close window after Paste)

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> ListByNumbers()<br><br><SPAN style="color:#00007F">Dim</SPAN> c <SPAN style="color:#00007F">As</SPAN> Range<br><SPAN style="color:#00007F">Dim</SPAN> Crng <SPAN style="color:#00007F">As</SPAN> Range, WorkRng <SPAN style="color:#00007F">As</SPAN> Range<br><SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>, n <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>, a <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> ResultName <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN><br><br>n = 0<br>i = Application.WorksheetFunction. _<br>        Count(Sheets("Sheet1").Range("A2:AZ2"))<br><br><SPAN style="color:#00007F">Set</SPAN> Crng = Sheets("Sheet1").Range("A2:A" & Range("A2").End(xlDown).Row)<br><br><SPAN style="color:#00007F">For</SPAN> a = 1 <SPAN style="color:#00007F">To</SPAN> i<br>    <br>    <SPAN style="color:#00007F">Set</SPAN> WorkRng = Crng.Offset(0, 2 * n)<br>    <SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> c <SPAN style="color:#00007F">In</SPAN> WorkRng<br>        <SPAN style="color:#00007F">If</SPAN> c.Value < 8 And c.Value > 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#007F00">'''Currently the best I got</SPAN><br>     <br>            ResultName = c.Offset(0, 1).Value<br>               <br>            Sheets("Sheet2").Range("A1").Offset(1000, c.Value - 1).End(xlUp).Offset(1, 0).Value = ResultName<br>                <br>        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>    <br>    <SPAN style="color:#00007F">Next</SPAN> c<br>        <br>        n = n + 1<br><SPAN style="color:#00007F">Next</SPAN> a<br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>


To use, Press Alt + F8. Select ListByNumbers and Run.
Note this uses sheets Named "Sheet1" and "Sheet2".

The raw data is on sheet 1, the results will go on sheet 2. Sheet 2 is blank with only headers in row 1:1.
 
Upvote 0
wow, that is awesome. first time i have used VBA!

seems to work absolutely perfectly for the first 7 Lists (taking in data from A1 to N49), but doesn't seem to pick up the rest?

my range of data is A1 to AH49 (17 identifier columns and 17 name lists)

i am a VBA novice so am unsure how to change the range in the VBA module. that is the only thing needed and this will work perfectly!
 
Upvote 0
Welcome to VBA. I am fairly new to that side of excel too.

Through row 2:2 in sheet 1, the macro counts numbers. So do you have numbers every other row through Col. AH? Or, is there a number missing near Column N:N in row 2?
 
Upvote 0
excellent work Repairman!

appreciate all your help. It works perfectly when there is a number in all lists beginning column 2:2.

cheers
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,738
Members
448,988
Latest member
BB_Unlv

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