VLOOKUP For Multiple Matches

srj1359

New Member
Joined
Mar 5, 2015
Messages
46
Office Version
  1. 2016
Platform
  1. Windows
Hello!

I have two sheets (Titles and Accounts).

The Accounts sheet has two columns: Participant Name (column A) and PRODUCT_ID (column B).

The Titles sheet has 32 columns, but the only one that matters is PRODUCT_ID (column AF).

In the Accounts sheet, multiple participants can have the same product ID.

In the Titles sheet, multiple titles can have the same product ID.

I'm trying to find a way to search to pull in the multiple participant names that match each product ID and the only way I think of is a VLOOKUP (though I'm open to other suggestions).

Please let me know if I need to clarify anything.

If it helps, I work in publishing, so think of it in terms of customer A bought a Science bundle and a History bundle. Customer B only bought a Science bundle. Each bundle has multiple books in it. How can I find out how many titles customer A has and how many customer B has?

Thank you in advance. I have been searching and trying different ideas for hours and would so appreciate some help from someone with more knowledge than me :)
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
With Power Query, you can join the two tables/ranges for common fields and extract the pertinent data. If you provide some samples of both sheets 8-12 records only then I can show you how to do this. Otherwise you will need to employ some VBA .
 
Upvote 0
Hi @alansidman

Thank you for your response! I've been spending most of my time these past few days trying to get a power query to work, so if you can help, that would be great.

I'm operating on Microsoft Excel 2016.

The main thing that has been causing me trouble here is this is a tool I'm creating for many people to use and this will be updated frequently so the file name will change, which means I can't incorporate into the VBA.

I've attached two screenshots of my data (I altered it to protect customers, so please let me know if I need to give more detail). I had created the "Export" tab as a place to put the power pivot, but as I said, have been having trouble.

Thank you, thank you, thank you for any help you can offer!!!
 

Attachments

  • Titles.PNG
    Titles.PNG
    78.8 KB · Views: 13
  • Accounts.PNG
    Accounts.PNG
    78.7 KB · Views: 12
Upvote 0
I had similar issues before and Peter kindly provided a great solutions


Maybe one of them could be applied
 
Upvote 0
Thank you, @Dave87!

@Peter_SSs - I looked over the links Dave sent above and the first two are very close to what I need.

Above I told alansidman I'm operating on Microsoft Excel 2016, but I was mistaken. I'm actually using Microsoft 365, but it's a business license, so the system administrator installs the updates and I'm afraid it does not appear as though I have the FILTER function (just FILTERXML).

I did try it on my personal computer (which also has 365), and this is almost exactly right, but I wondered if there's a way to add a space in place of or in addition to wrapping text so that I am able to separate multiple results with text to columns?

Also, if I incorporate this formula into a macro, will others accessing this document that don't have 365 get an error?

Lastly, since it seems I don't have the most recent 365 update on my work computer, I also tried the MultipleLookups UDF, but I keep getting a #VALUE! error and am not sure what I'm doing wrong unless it was specific just to Dave's request?

Any help you can provide is greatly appreciated. Thank you!!
 
Upvote 0
If you are going to use a macro, then you probably don't need a formula at all as the macro could do it all.
If you do use a formula with the FILTER function then all users will need to have that function.
You have shown us some sample data but ..
- we cannot copy from a picture to test, and
- we cannot see your expected results

Therefore, can you give us the sample data again but also include the expected results (you mentioned text to columns so make sure the expected results are in the final form that you want).
When doing the above, if you can use XL2BB then we can easily copy for testing. :)
 
Upvote 0
@Peter_SSs thank you for the XL2BB article. I was wondering how people posted those captures. I hope the below is helpful, but please let me know if more is needed from me.

Book1.xlsx
AB
1Participant NamePRODUCT_ID
2ABC UniversityAAA-00001
3ABC UniversityAAA-00002
4ABC UniversityAAA-00003
5ABC UniversityAAA-00004
6ABC UniversityAAA-00005
7DEF UniversityAAA-00001
8DEF UniversityAAA-00002
9DEF UniversityAAA-00003
10DEF UniversityAAA-00004
11DEF UniversityAAA-00005
12DEF UniversityZZZ-00001
13DEF UniversityZZZ-00002
14DEF UniversityZZZ-00003
15DEF UniversityZZZ-00004
16DEF UniversityZZZ-00005
Accounts


Book1.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAF
1publication_titleprint_identifieronline_identifierdate_first_issue_onlinenum_first_vol_onlinenum_first_issue_onlinedate_last_issue_onlinenum_last_vol_onlinenum_last_issue_onlinetitle_urlfirst_authortitle_idembargo_infocoverage_depthnotespublisher_namepublication_typedate_monograph_published_printdate_monograph_published_onlinemonograph_volumemonograph_editionfirst_editorparent_publication_title_idpreceding_publication_title_idaccess_typeOCNDOIMARC Control NumberSubjectModulePLATFORMPRODUCT_ID
2In Search of Lost Time by Marcel ProustAAA-00001
3Ulysses by James JoyceAAA-00002
4Don Quixote by Miguel de CervantesAAA-00003
5The Great Gatsby by F. Scott FitzgeraldAAA-00004
6One Hundred Years of Solitude by Gabriel Garcia MarquezAAA-00005
7Moby **** by Herman MelvilleZZZ-00001
8War and Peace by Leo TolstoyZZZ-00002
9Lolita by Vladimir NabokovZZZ-00003
10Hamlet by William ShakespeareZZZ-00004
11The Catcher in the Rye by J. D. SalingerZZZ-00005
12The Odyssey by HomerAAA-00001
13The Brothers Karamazov by Fyodor DostoyevskyAAA-00002
14Crime and Punishment by Fyodor DostoyevskyAAA-00003
15Madame Bovary by Gustave FlaubertAAA-00004
16The Divine Comedy by Dante AlighieriAAA-00005
17The Adventures of Huckleberry Finn by Mark TwainZZZ-00001
18Alice's Adventures in Wonderland by Lewis CarrollZZZ-00002
19Pride and Prejudice by Jane AustenZZZ-00003
20Wuthering Heights by Emily BrontëZZZ-00004
21To the Lighthouse by Virginia WoolfZZZ-00005
Titles
 
Upvote 0
Thanks for getting XL2BB going. (y)
BTW, you can hide irrelevant columns to keep the screen shot smaller (eg columns B:AE in 'Titles')

Now, what about this?
Therefore, can you give us the sample data again but also include the expected results (you mentioned text to columns so make sure the expected results are in the final form that you want).
 
Upvote 0
@Peter_SSs

As you can see, I have two sheets (Titles and Accounts). The Accounts sheet has two columns: Participant Name (column A) and PRODUCT_ID (column B). The Titles sheet has 32 columns, but the only one that matters is PRODUCT_ID (column AF).

In the Accounts sheet, multiple participants can have the same product ID. In the Titles sheet, multiple titles can have the same product ID. I'm trying to find a way to search to pull in the multiple participant names that match each product ID (into column AG on the Titles sheet, for example)

Second sheet is captured again below with those rows hidden to make it easier to see:

Book1.xlsx
AAF
1publication_titlePRODUCT_ID
2In Search of Lost Time by Marcel ProustAAA-00001
3Ulysses by James JoyceAAA-00002
4Don Quixote by Miguel de CervantesAAA-00003
5The Great Gatsby by F. Scott FitzgeraldAAA-00004
6One Hundred Years of Solitude by Gabriel Garcia MarquezAAA-00005
7Moby **** by Herman MelvilleZZZ-00001
8War and Peace by Leo TolstoyZZZ-00002
9Lolita by Vladimir NabokovZZZ-00003
10Hamlet by William ShakespeareZZZ-00004
11The Catcher in the Rye by J. D. SalingerZZZ-00005
12The Odyssey by HomerAAA-00001
13The Brothers Karamazov by Fyodor DostoyevskyAAA-00002
14Crime and Punishment by Fyodor DostoyevskyAAA-00003
15Madame Bovary by Gustave FlaubertAAA-00004
16The Divine Comedy by Dante AlighieriAAA-00005
17The Adventures of Huckleberry Finn by Mark TwainZZZ-00001
18Alice's Adventures in Wonderland by Lewis CarrollZZZ-00002
19Pride and Prejudice by Jane AustenZZZ-00003
20Wuthering Heights by Emily BrontëZZZ-00004
21To the Lighthouse by Virginia WoolfZZZ-00005
Titles
 
Upvote 0
I'm trying to find a way to search to pull in the multiple participant names that match each product ID (into column AG on the Titles sheet, for example)
So you no longer want the values in separate columns as suggested by your mention of Text to Columns in post 5?
 
Upvote 0

Forum statistics

Threads
1,215,214
Messages
6,123,661
Members
449,114
Latest member
aides

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