VLookup multiple values on very large data file

GoodDaySir0

New Member
Joined
Feb 18, 2016
Messages
3
I'm trying to perform a vlookup to display any and all values associated with the lookup value. See example below:

What I have: Book1.xlsx - Sheet1
IDResults
JimWon
SaraWon
MikeLost
SaraTied
SaraWon
PeterLost
MikeTied

<tbody>
</tbody>


What I want: Book2.xlsx - Sheet1

IDResultsResultsResultsResultsResults
SaraWonTiedWon
JimWon
MikeLostTied
PeterLost

<tbody>
</tbody>


Here's the formula I've been using (plugging into B2 on Book2 and hitting CTRL+SHIFT+ENTER):

{=INDEX([Book1.xlsx]Sheet1!$A$2:$B$8,SMALL(IF([Book1.xlsx]Sheet1!$A$2:$B$8=$A2,ROW([Book1.xlsx]Sheet1!$A$2:$B$8)-1),COLUMNS($B2:B2)),2)}

The problem I'm running into is that my Book1 has about 1,000,000 rows of data and my Book2 has about 500,000 IDs. Also one single ID can have up to about 20 results. When I run this formula for more than 5 cells at a time, I get the error message saying excel ran out of resources while attempting to calculate one or more formulas.

Is there a better way of displaying all the results for each ID within a single row (per ID)?

Thanks!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Enter this formula to get uniqe names list in D2 and copy down

=LOOKUP("zzz",CHOOSE({1,2},"",INDEX(A$2:A$8,MATCH(0,INDEX(COUNTIF(D$1:D1,A$2:A$8),,),))))

Enter this array formula in E2 and copy across and down

=LOOKUP("zzz",CHOOSE({1,2},"",INDEX($B:$B,SMALL(IF($A$2:$A$8=$D2,ROW($A$2:$A$8)),COLUMNS($E:E)))))

***Array formula must be entered by using key combination of CTRL+SHIFT+ENTER and not just ENTER


Book1
ABCDEFG
1NameResultsTransposed
2JimWonJimWon
3SaraWonSaraWonTiedWon
4MikeLostMikeLostTied
5SaraTiedPeterLost
6SaraWon
7PeterLost
8MikeTied
Sheet1
 
Last edited:
Upvote 0
Enter this formula to get uniqe names list in D2 and copy down

=LOOKUP("zzz",CHOOSE({1,2},"",INDEX(A$2:A$8,MATCH(0,INDEX(COUNTIF(D$1:D1,A$2:A$8),,),))))

Enter this array formula in E2 and copy across and down

=LOOKUP("zzz",CHOOSE({1,2},"",INDEX($B:$B,SMALL(IF($A$2:$A$8=$D2,ROW($A$2:$A$8)),COLUMNS($E:E)))))

***Array formula must be entered by using key combination of CTRL+SHIFT+ENTER and not just ENTER

ABCDEFG
1NameResultsTransposed
2JimWonJimWon
3SaraWonSaraWonTiedWon
4MikeLostMikeLostTied
5SaraTiedPeterLost
6SaraWon
7PeterLost
8MikeTied

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>

Hi AlKey,

Thanks for the response. The formula isn't working because my IDs are numerical IDs instead of names like Sara, Jim, Mike. Sorry, I should have specified that.

Would you be able to make this work for numerical IDs instead of names?

Thanks!
 
Upvote 0
Enter this formula to get uniqe names list in D2 and copy down

=IFERROR(INDEX(A$2:A$8,MATCH(0,INDEX(COUNTIF(D$1:D1,A$2:A$8),,),)),"")

Enter this array formula in E2 and copy across and down

=IFERROR(INDEX($B:$B,SMALL(IF($A$2:$A$8=$D2,ROW($A$2:$A$8)),COLUMNS($E:E))),"")

***Array formula must be entered by using key combination of CTRL+SHIFT+ENTER and not just ENTER


Book1
ABCDEFGH
1NameResultsTransposed
21001Won1001Won
31002Won1002WonTiedWon
41003Lost1003LostTied
51002Tied1004Lost
61002Won
71004Lost
81003Tied
Sheet1
 
Upvote 0
Hi AlKey,

Thanks for the response. The formula isn't working because my IDs are numerical IDs instead of names like Sara, Jim, Mike. Sorry, I should have specified that.

Would you be able to make this work for numerical IDs instead of names?

Thanks!

Nevermind! I converted the ID numbers to text so it's working now. Unfortunately it's still giving me an error message because of the large numbers of rows I'm working with.
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,822
Members
449,469
Latest member
Kingwi11y

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