Formula to return list of matches

Phil_SA

New Member
Joined
Feb 24, 2016
Messages
2
Hi - I've got a list of countries that correspond to certain numbers, where some numbers correspond to more than one country. I need to create a lookup on a separate tab that will list all the names that correspond to a certain number.

Example where Denmark is A1 and "3" is in B1

[TABLE="width: 289"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Denmark[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]Norway[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]Sweden[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]Netherlands[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]United States[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]STATE OF QATAR[/TD]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD]Hong Kong[/TD]
[TD="align: right"]7[/TD]
[/TR]
[TR]
[TD]NEW ZEALAND[/TD]
[TD="align: right"]7[/TD]
[/TR]
[TR]
[TD]Belgium[/TD]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD]Austria[/TD]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD]Finland[/TD]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD]Kuwait[/TD]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD]EMIRATE OF ABU DHABI[/TD]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD]France[/TD]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD]South Korea[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD]UNITED KINGDOM[/TD]
[TD="align: right"]10[/TD]
[/TR]
</tbody>[/TABLE]

On the next tab, I want to be able to look up all countries that are a specific number linked to the previous tab. I've tried to use some form of Index Match but haven't gotten any success. Any help would be great! Thanks.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
with a pivot table.


Book1
GHIJ
1countrynumberROW
2Denmark33
3Norway3Denmark
4Sweden3Netherlands
5Netherlands3Norway
6United States4Sweden
7STATE OF QATAR64
8Hong Kong7United States
9NEW ZEALAND76
10Belgium8STATE OF QATAR
11Austria87
12Finland8Hong Kong
13Kuwait9NEW ZEALAND
14EMIRATE OF ABU DHABI98
15France9Austria
16South Korea10Belgium
17UNITED KINGDOM10Finland
189
19EMIRATE OF ABU DHABI
20France
21Kuwait
2210
23South Korea
24UNITED KINGDOM
25Eindtotaal
26
sheet2
 
Upvote 0
alternative with index / match


Book1
GHIJK
1countrynumberhelp3
2Denmark331Denmark
3Norway332Norway
4Sweden333Sweden
5Netherlands334Netherlands
6United States441
7STATE OF QATAR661
8Hong Kong771
9NEW ZEALAND772
10Belgium881
11Austria882
12Finland883
13Kuwait991
14EMIRATE OF ABU DHABI992
15France993
16South Korea10101
17UNITED KINGDOM10102
sheet2
Cell Formulas
RangeFormula
K2=IFERROR(INDEX($G$1:$I$17,MATCH(($K$1&ROW()-1)*1,$I$1:$I$17,0),1),"")
I2=(H2&COUNTIF($H$2:$H2,H2))*1
 
Upvote 0
Let A1:B16 house the source data.

Let A1 of Sheet2 house 3.

In A3 of Sheet2 just enter:
Rich (BB code):
=COUNTIFS(Sheet1!$B$1:$B$16,$A1)

In A4 of Sheet2 control+shift+enter, not just enter, and copy down:
Rich (BB code):
=IF(ROWS(A$4:A4)<=A$3,INDEX(Sheet1!$A$1:$A$16,SMALL(IF($B$1:$B$16=A$1,
    ROW(Sheet1!$A$1:$A$16)-ROW(Sheet1!$A$1)+1),ROWS(A$4:A4))),"")
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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