VLOOKUP/INDEX/?? solution

centurymantra

New Member
Joined
Jan 30, 2017
Messages
26
I am working on a project with a couple of different sets ofdata that I would love to automate with an Excel formula if possible.<o:p></o:p>
<o:p> </o:p>
I have one set of data with two columns like this:<o:p></o:p>
A B<o:p></o:p>
1621<o:p></o:p>
001<o:p></o:p>
1641<o:p></o:p>
001<o:p></o:p>
1661<o:p></o:p>
001<o:p></o:p>
1672<o:p></o:p>
001<o:p></o:p>
1681<o:p></o:p>
001<o:p></o:p>
3200<o:p></o:p>
002<o:p></o:p>
3210<o:p></o:p>
002<o:p></o:p>
3240<o:p></o:p>
002<o:p></o:p>
1422<o:p></o:p>
003<o:p></o:p>
1322<o:p></o:p>
004<o:p></o:p>
1323<o:p></o:p>
004<o:p></o:p>
1303<o:p></o:p>
005<o:p></o:p>
1312<o:p></o:p>
005<o:p></o:p>
1314<o:p></o:p>
005<o:p></o:p>
1315<o:p></o:p>
005<o:p></o:p>
1316<o:p></o:p>
005<o:p></o:p>
1317<o:p></o:p>
005<o:p></o:p>
1318<o:p></o:p>
005<o:p></o:p>
1320<o:p></o:p>
005<o:p></o:p>
6370<o:p></o:p>
012<o:p></o:p>
6375<o:p></o:p>
012<o:p></o:p>
6380<o:p></o:p>
012<o:p></o:p>
6385<o:p></o:p>
012<o:p></o:p>
6100<o:p></o:p>
013<o:p></o:p>
5610<o:p></o:p>
014<o:p></o:p>
5730<o:p></o:p>
014<o:p></o:p>
6075<o:p></o:p>
014<o:p></o:p>
6080<o:p></o:p>
014<o:p></o:p>
6085<o:p></o:p>
014<o:p></o:p>
<tbody> </tbody>
<o:p> </o:p>
I am working with another set of data like this:<o:p></o:p>
A B C<o:p></o:p>
004<o:p></o:p>
CHRISTINE SMITH<o:p></o:p>
000146703<o:p></o:p>
011<o:p></o:p>
CHRISTINE SMITH<o:p></o:p>
000146703<o:p></o:p>
012<o:p></o:p>
CHRISTINE SMITH<o:p></o:p>
000146703<o:p></o:p>
014<o:p></o:p>
CHRISTINE SMITH<o:p></o:p>
000146703<o:p></o:p>
712<o:p></o:p>
CHRISTINE SMITH<o:p></o:p>
000146703<o:p></o:p>
702<o:p></o:p>
CHRISTOPHER HIGSON<o:p></o:p>
001090588<o:p></o:p>
716<o:p></o:p>
CHRISTOPHER HIGSON<o:p></o:p>
001090588<o:p></o:p>
724<o:p></o:p>
CHRISTOPHER HIGSON<o:p></o:p>
001090588<o:p></o:p>
<tbody> </tbody>
<o:p> </o:p>
Using the second set of data, I need to look at the value incolumn A and find all instances where it occurs in column B of the firstset. Then I want to create entries in athird workbook that ultimately will come up with the following columns. Taking Christine Smith as an example, thiswould be the result:<o:p></o:p>
<o:p> </o:p>
A B<o:p></o:p>
<o:p> </o:p>
1322<o:p></o:p>
000146703<o:p></o:p>
1323<o:p></o:p>
000146703<o:p></o:p>
6370<o:p></o:p>
000146703<o:p></o:p>
6375<o:p></o:p>
000146703<o:p></o:p>
6380<o:p></o:p>
000146703<o:p></o:p>
6385<o:p></o:p>
000146703<o:p></o:p>
5610<o:p></o:p>
000146703<o:p></o:p>
5730<o:p></o:p>
000146703<o:p></o:p>
6075<o:p></o:p>
000146703<o:p></o:p>
6080<o:p></o:p>
000146703<o:p></o:p>
6085<o:p></o:p>
000146703<o:p></o:p>
<tbody> </tbody>
<o:p> </o:p>
<o:p> </o:p>
This is a table with the number in column C of the secondtable with the value of column A in the first set of data in every instancewhere column A in the second data set is found in column B of the first set. Hopefully, this is clear enough that it can be understood. I would LOVE to find a way of automatingthis, but it is a little beyond my grasp of Excel to figure it out.<o:p></o:p>
Any help on this is much appreciated!<o:p></o:p>
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Let A1:B29 of Sheet1 house the first set of data.
Let A1:C8 of Sheet2 house the second set of data.

Row\Col
A​
B​
1​
11​
2​
3​
1322​
000146703
4​
1323​
000146703
5​
6370​
000146703
6​
6375​
000146703
7​
6380​
000146703
8​
6385​
000146703
9​
5610​
000146703
10​
5730​
000146703
11​
6075​
000146703
12​
6080​
000146703
13​
6085​
000146703
14​

In A1 of Sheet3 (the results sheet), control+shift+enter, not just enter:

=SUM(IF(ISNUMBER(MATCH(Sheet1!$B$1:$B$29,Sheet2!$A$1:$A$8,0)),1))

In A3 of Sheet3 control+shift+enter, not just enter, and copy down:

=IF(ROWS($A$3:A3)>$A$1,"",INDEX(Sheet1!$A$1:$A$29,SMALL(IF(ISNUMBER(MATCH(Sheet1!$B$1:$B$29,Sheet2!$A$1:$A$8,0)),ROW(Sheet1!$A$1:$A$29)-ROW(Sheet1!$A$1)+1),ROWS($A$3:A3))))

In B3 of Sheet3 just enter and copy down:

=IF($A3="","",VLOOKUP(VLOOKUP($A3,Sheet1!$A$1:$B$29,2,0),Sheet2!$A$1:$C$8,3,0))
 
Upvote 0
Excellent! Thanks abunch for this formula. I did work withthis, modifying the formula to reflect the actual number of rows in each sheet(471 in sheet 1 and 1138 in sheet 2), but found it was returning incompleteresults. <o:p></o:p>
For example, I have one person from sheet two:<o:p></o:p>
Row<o:p></o:p>
A<o:p></o:p>
B<o:p></o:p>
C<o:p></o:p>
275<o:p></o:p>
500<o:p></o:p>
TRACY SMITH<o:p></o:p>
001118229<o:p></o:p>
276<o:p></o:p>
501<o:p></o:p>
TRACY SMITH<o:p></o:p>
001118229<o:p></o:p>
277<o:p></o:p>
504<o:p></o:p>
TRACY SMITH<o:p></o:p>
001118229<o:p></o:p>
278<o:p></o:p>
505<o:p></o:p>
TRACY SMITH<o:p></o:p>
001118229<o:p></o:p>
279<o:p></o:p>
507<o:p></o:p>
TRACY SMITH<o:p></o:p>
001118229<o:p></o:p>
280<o:p></o:p>
508<o:p></o:p>
TRACY SMITH<o:p></o:p>
001118229<o:p></o:p>
281<o:p></o:p>
509<o:p></o:p>
TRACY SMITH<o:p></o:p>
001118229<o:p></o:p>
282<o:p></o:p>
510<o:p></o:p>
TRACY SMITH<o:p></o:p>
001118229<o:p></o:p>
283<o:p></o:p>
511<o:p></o:p>
TRACY SMITH<o:p></o:p>
001118229<o:p></o:p>
284<o:p></o:p>
512<o:p></o:p>
TRACY SMITH<o:p></o:p>
001118229<o:p></o:p>
285<o:p></o:p>
513<o:p></o:p>
TRACY SMITH<o:p></o:p>
001118229<o:p></o:p>
<tbody> </tbody>
<o:p> </o:p>
The corresponding data in sheet one that would be referencedwould be in this section of sheet 1:<o:p></o:p>
Row<o:p></o:p>
A<o:p></o:p>
B<o:p></o:p>
261<o:p></o:p>
3150<o:p></o:p>
500<o:p></o:p>
262<o:p></o:p>
3350<o:p></o:p>
500<o:p></o:p>
263<o:p></o:p>
3650<o:p></o:p>
500<o:p></o:p>
264<o:p></o:p>
5250<o:p></o:p>
500<o:p></o:p>
265<o:p></o:p>
5280<o:p></o:p>
500<o:p></o:p>
266<o:p></o:p>
6155<o:p></o:p>
500<o:p></o:p>
267<o:p></o:p>
6250<o:p></o:p>
500<o:p></o:p>
268<o:p></o:p>
6254<o:p></o:p>
500<o:p></o:p>
269<o:p></o:p>
5254<o:p></o:p>
501<o:p></o:p>
270<o:p></o:p>
3352<o:p></o:p>
504<o:p></o:p>
271<o:p></o:p>
5252<o:p></o:p>
504<o:p></o:p>
272<o:p></o:p>
6252<o:p></o:p>
504<o:p></o:p>
273<o:p></o:p>
3351<o:p></o:p>
507<o:p></o:p>
274<o:p></o:p>
5251<o:p></o:p>
507<o:p></o:p>
275<o:p></o:p>
6251<o:p></o:p>
507<o:p></o:p>
276<o:p></o:p>
5250<o:p></o:p>
508<o:p></o:p>
277<o:p></o:p>
5290<o:p></o:p>
508<o:p></o:p>
278<o:p></o:p>
5630<o:p></o:p>
508<o:p></o:p>
279<o:p></o:p>
3331<o:p></o:p>
509<o:p></o:p>
280<o:p></o:p>
5151<o:p></o:p>
509<o:p></o:p>
281<o:p></o:p>
6137<o:p></o:p>
509<o:p></o:p>
282<o:p></o:p>
5110<o:p></o:p>
510<o:p></o:p>
283<o:p></o:p>
5810<o:p></o:p>
511<o:p></o:p>
284<o:p></o:p>
5780<o:p></o:p>
512<o:p></o:p>
285<o:p></o:p>
5800<o:p></o:p>
513<o:p></o:p>
<tbody> </tbody>
<o:p> </o:p>
This is what I get back for this person:<o:p></o:p>
<o:p> </o:p>
3331<o:p></o:p>
001118229<o:p></o:p>
3352<o:p></o:p>
001118229<o:p></o:p>
5151<o:p></o:p>
001118229<o:p></o:p>
5252<o:p></o:p>
001118229<o:p></o:p>
6137<o:p></o:p>
001118229<o:p></o:p>
6252<o:p></o:p>
001118229<o:p></o:p>
<tbody> </tbody>
<o:p> </o:p>
Analyzing this, it is only returning results for 504 and 509of column C in sheet 1. N Any thoughts on what is happening with this?<o:p></o:p>
<o:p> </o:p>
Thanks!<o:p></o:p>
 
Upvote 0
If we were to look at the results and sort by column B, the results I would like to see under Tracy Smith's number of 001118229 would be:

AB
3150001118229
3350001118229
3650001118229
5250001118229
5280001118229
6155001118229
6250001118229
6254001118229
5254001118229
3352001118229
5252001118229
6252001118229
3351001118229
5251001118229
6251001118229
5250001118229
5290001118229
5630001118229
3331001118229
5151001118229
6137001118229
5110001118229
5810001118229
5780001118229
5800001118229
<colgroup><col width="134" style="width: 100pt; mso-width-source: userset; mso-width-alt: 4750;"> <col width="87" style="width: 65pt; mso-width-source: userset; mso-width-alt: 3100;"> <tbody> </tbody>
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,094
Latest member
teemeren

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