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

Denmark3
Norway3
Sweden3
Netherlands3
United States4
STATE OF QATAR6
Hong Kong7
NEW ZEALAND7
Belgium8
Austria8
Finland8
Kuwait9
EMIRATE OF ABU DHABI9
France9
South Korea10
UNITED KINGDOM10

<colgroup><col><col></colgroup><tbody>
</tbody>

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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,215,338
Messages
6,124,356
Members
449,155
Latest member
ravioli44

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