revers lookup duplicated values

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I have table like below, user will enter age and I want excel to return the name, so I did match/index function like this

=INDEX(A2:D7,MATCH(G4,D2:D7,0),1)

G4 = age

Now if user enter G4 = 40 excel will return john, how can I ask excel to return linda as well. I am thinking it must be array formula, am I right? Thank you

namephone#addressage
john11 main st40
mary23 east ave50
lary35 west blvd60
linda47 main st40
mike511 east ave20
sue66 main st30

<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>
</tbody>
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
try PowerQuery

sourcelookup valueresult
namephone#addressageageagenamephone#address
john
1​
1 main st
40​
40​
40​
john
1​
1 main st
mary
2​
3 east ave
50​
40​
linda
4​
7 main st
lary
3​
5 west blvd
60​
linda
4​
7 main st
40​
mike
5​
11 east ave
20​
sue
6​
6 main st
30​

Code:
[SIZE=1]let
    Source = Table.NestedJoin(Table5,{"age"},Table6,{"age"},"Table6",JoinKind.LeftOuter),
    #"Expanded Table6" = Table.ExpandTableColumn(Source, "Table6", {"name", "phone#", "address"}, {"name", "phone#", "address"})
in
    #"Expanded Table6"[/SIZE]
 
Upvote 0
ABCDEFGH
1
2
3
name​
phone#addressageageNames
4john11 main st4040john
5mary23 east ave50linda
6lary35 west blvd60
7linda47 main st40
8mike511 east ave20
9sue66 main st30

<tbody>
</tbody>


CellArray Formula
H4=IFERROR(INDEX($A$1:$A$9, SMALL(IF($D$4:$D$9=$G$4, ROW()), ROW()-3)),"")

<tbody>
</tbody>

To accept you must press Shift + Control + Enter

Note: It is important that data begin in the cell A4
 
Upvote 0
Formula :=IFERROR(INDEX($A$2:$A$7,AGGREGATE(15,6,ROW($A$2:$A$7)-ROW($A$2)+1/($D2=$D$2:$D$7),COLUMNS($D$2:D2))),"")


I0Uqymnw.png
 
Upvote 0
Thank you all for your help. Could you please break down the formula, specially this part

SMALL(IF($D$4:$D$9=$G$4, ROW()), ROW()-3)),"")

Thank you once again

ABCDEFGH
1
2
3
name​
phone#addressageageNames
4john11 main st4040john
5mary23 east ave50linda
6lary35 west blvd60
7linda47 main st40
8mike511 east ave20
9sue66 main st30

<tbody>
</tbody>


CellArray Formula
H4=IFERROR(INDEX($A$1:$A$9, SMALL(IF($D$4:$D$9=$G$4, ROW()), ROW()-3)),"")

<tbody>
</tbody>

To accept you must press Shift + Control + Enter

Note: It is important that data begin in the cell A4
 
Upvote 0
With this we get the row number that is equal to 40

IF($D$4:$D$9=$G$4, ROW())

Excel Workbook
ABCDEF
1
2
3namephone#addressageagerow
4john11 main st40404
5mary23 east ave50FALSO
6lary35 west blvd60FALSO
7linda47 main st407
8mike511 east ave20FALSO
9sue66 main st30FALSO
Hoja1


The SMAL Function will help us sort the data in ascending order. The first argument of the function is the same formula as in the previous step and the second argument is the Row function that will help us indicate the position we need:

Excel Workbook
ABCDEF
1
2
3namephone#addressageagerow
4john11 main st40404
5mary23 east ave507
6lary35 west blvd60#NUM!
7linda47 main st40#NUM!
8mike511 east ave20#NUM!
9sue66 main st30#NUM!
Hoja1



You can see that the second argument of the SMALL function is the function FILA minus 3. The reason for this operation is that the data starts in the fourth row of the sheet but we need to make an adjustment, through the subtraction, so that it starts by number 1.
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,397
Members
449,081
Latest member
JAMES KECULAH

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