VLOOKUP to matching column values, how to add multiple row values

anonemous

New Member
Joined
Dec 2, 2015
Messages
16
Office Version
  1. 365
  2. 2016
  3. 2010
Platform
  1. Windows
  2. MacOS
Hello folks,
I'm here again with another intricate request, but I believe this is a useful formula in today's data.

I work with multiple databases - one houses some information, and the other houses other information. This is done for security purposes to keep client information confidential from misuse.
So, I am tasked with combining data from more than one source and making a product from this.

In a particular example, I will have two excel sheets going. One with the master list of "data," but general data. The other list will have all the wanted values that apply to the data.
I usually use vlookup between the two sheets, e.g.
VLOOKUP(A2,'OtherSheetName'!$A$1:$H$4000,2,0)
for a typical matching column A's values, pull Column B, C, D, etc and a majority of the time it's completed.

However most recently we started getting data that is going to multiple rows. Let me give a great example below.
We typically use a year and a 'case/order number' affixed to each master list of information, and that is how the data gets joined. In some of the more recent entries, there are multiples of unique row data per single case number:


Excel 2013/2016
AB
1OrderPerson
22018-01Joe
32018-02John
42018-03Julie
52018-04Jane
Sheet1




Excel 2013/2016
AB
1OrderContents
22018-01Apples
32018-01Carwash liquid
42018-02Apple IPHONE cell phone case
52018-02Levi men's jeans, 0114581
62018-03Apples
72018-03Grapes
82018-03Coca-cola
92018-03RETURN ORDER: 2017-0801 WOMEN'S SHOES 78871
102018-03Dorito's Chips, Cool Ranch flavor
112018-04BOOK ISBN 9781483217000
Sheet2


This is the desired output I am looking for, so I can do pivot tables and perform additional data analysis from the master combined data:

Excel 2013/2016
ABC
1OrderPersonOrder Contents
22018-01JoeApples
32018-01JoeCarwash liquid
42018-02JohnApple IPHONE cell phone case
52018-02JohnLevi men's jeans, 0114581
62018-03JulieApples
72018-03JulieGrapes
82018-03JulieCoca-cola
92018-03JulieRETURN ORDER: 2017-0801 WOMEN'S SHOES 78871
102018-03JulieDorito's Chips, Cool Ranch flavor
112018-04JaneBOOK ISBN 9781483217000
Sheet1



Thank you very much for assisting and reading.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Just add a column to the sheet 2 table and vlookup from sheet 1, no?

Yes, I had done this before but the reverse way does not catch all the data, so that is why I work the first sheet instead of reverse.
In other words the first sheet (Sheet 1) has the absolute reference data, but the second sheet (Sheet 2) does not have all the information from Column A of Sheet 1 due to data errors or other misc issues.

So I need to go back and find the missing rows from sheet 1, hence why I try and work from the first sheet only.
 
Upvote 0
Something like:


Excel 2010
AB
1OrderContents
22018-01Apples
32018-01Carwash liquid
42018-02Apple IPHONE cell phone case
52018-02Levi men's jeans, 0114581
62018-03Apples
72018-03Grapes
82018-03Coca-cola
92018-03RETURN ORDER: 2017-0801 WOMEN'S SHOES 78871
102018-03Dorito's Chips, Cool Ranch flavor
112018-04BOOK ISBN 9781483217000
Sheet2



Excel 2010
ABCD
1OrderPerson
22018-01Joe2
32018-02John2
42018-03Julie5
52018-04Jane1
6
72018-01JoeApples
82018-01JoeCarwash liquid
92018-02JohnApple IPHONE cell phone case
102018-02JohnLevi men's jeans, 0114581
112018-03JulieApples
122018-03JulieGrapes
132018-03JulieCoca-cola
142018-03JulieRETURN ORDER: 2017-0801 WOMEN'S SHOES 78871
152018-03JulieDorito's Chips, Cool Ranch flavor
162018-04JaneBOOK ISBN 9781483217000
Sheet1
Cell Formulas
RangeFormula
D2=COUNTIF(Sheet2!$A$2:$A$11,Sheet1!A2)
A7=LOOKUP(ROW(A1),SUMIF(OFFSET(D$1,,,ROW($1:$99),),"<>")+1,A$2:A$99)&""
B7=LOOKUP(ROW(B1),SUMIF(OFFSET(D$1,,,ROW($1:$99),),"<>")+1,B$2:B$99)&""
C7{=INDEX(Sheet2!$B$1:$B$11,SMALL(IF(Sheet2!$A$2:$A$11=Sheet1!A7,ROW(Sheet2!$A$2:$A$11)),COUNTIF($A$7:A7,A7)))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,972
Messages
6,122,530
Members
449,088
Latest member
RandomExceller01

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