lookup help - extracting values not from the first match in a dataset

Monty85

New Member
Joined
May 6, 2019
Messages
43
Office Version
  1. 365
Platform
  1. Windows
I'm having trouble trying to find a way to lookup values from the 2nd, 3rd, etc, matches in a dataset.

In the below example, i want to use a formula to extract the multiple note lines for each person.

1680232604881.png


The end result would have a column for each note but just the one row for each person;

1680232697953.png


This will need to work for Excel 2016.

I've found some suggested solutions which use INDEX/MATCH and i seem to be able to get it to work for one line but run into issues when copying the formula down. It was also a solution which required the use of CTRL-SHIFT-ENTER which wasn't ideal. If there's a way to avoid that, awesome!

Appreciate the help as always,
Monty
 
The formulas below should work without CTRL-SHIFT-ENTER.
The formula in F2 will return the unique ID's from column A. However instead of using this long formula I'd probably just copy column A over to F and and use the REMOVE DUPLICATES from the ribbon under DATA.

You can just drag the formula in G2 down and over 1 column as needed.
Just drag the formula in I2 down and across 3 columns as needed.

Book3
ABCDEFGHIJK
1IDNameDOBNotesIDNameDOBNote Line 1Note Line 2Note Line 3
21234Bruce Wayne4/17/1915Note Line 11234Bruce Wayne4/17/1915Note Line 10Note Line 3
31234Bruce Wayne4/17/19155678Clark Kent4/18/1977Note Line 1Note Line 2Note Line 3
41234Bruce Wayne4/17/1915Note Line 3   
55678Clark Kent4/18/1977Note Line 1
65678Clark Kent4/18/1977Note Line 2
75678Clark Kent4/18/1977Note Line 3
Sheet3
Cell Formulas
RangeFormula
F2:F4F2=IFERROR(INDEX($A$2:$A$7,AGGREGATE(15,6,IF(FREQUENCY(MATCH($A$2:$A$7,$A$2:$A$7,0),ROW($A$2:$A$7)-ROW($A$2)+1),ROW($A$2:$A$7)-ROW($A$2)+1),ROWS($F$2:F2))),"")
G2:H4G2=IF($F2="","",INDEX(B$2:B$7,MATCH($F2,$A$2:$A$7,0),1))
I2:K3I2=INDEX($D$2:$D$7,AGGREGATE(15,6,(ROW($D$2:$D$7)-ROW($D$2)+1)/($A$2:$A$7=$F2),COLUMNS($I$2:I2)))
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
One way, for Ex2016 or older

Example.xlsx
ABCDEFGHIJK
1IDNameDOBNotesIDNameDOBNote Line 1Note Line 2Note Line 3
21234Bruce Wayne07 April 1915Note Line 11234Bruce Wayne07 April 1915Note Line 1 Note Line 3
31234Bruce Wayne07 April 19155678Clark Kent18 April 1977Note Line 1Note Line 2Note Line 3
41234Bruce Wayne07 April 1915Note Line 3      
55678Clark Kent18 April 1977Note Line 1      
65678Clark Kent18 April 1977Note Line 2      
75678Clark Kent18 April 1977Note Line 3      
8      
9      
10      
11      
12      
13      
Sheet1
Cell Formulas
RangeFormula
F2:F13F2=IFERROR(INDEX($A$2:$A$7,MATCH(0,INDEX(COUNTIF($F$1:F1,$A$2:$A$7),),0)),"")
G2:G13G2=IF(F2="","",VLOOKUP($F2,$A$2:$D$7,2,0))
H2:H13H2=IF(G2="","",VLOOKUP($F2,$A$2:$D$7,3,0))
I2:K13I2=IF($F2="","",IF(INDEX($D:$D,AGGREGATE(15,6,ROW($A$2:$A$7)/($A$2:$A$7=$F2),COLUMNS($A:A)))=0,"",INDEX($D:$D,AGGREGATE(15,6,ROW($A$2:$A$7)/($A$2:$A$7=$F2),COLUMNS($A:A)))))
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,727
Members
449,049
Latest member
MiguekHeka

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