Need excel formula to vlookup and give multiple results

tonyjyoo

Board Regular
Joined
Aug 5, 2016
Messages
167
I have a sheet with data in columns A:D.

- Column D has i.e. state names
- Column A has i.e. cities

Is there a way to have a formula where it gives me say if I pick "california" in Column D, it spits out something like "Los Angeles, San Francisco, Irvine.....etc" ?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
There are many ways. The simplest is to use the new function FILTER (available in Excel 365) to extract and list the records according to a specified criteria. You can also use function TEXTJOIN to extract the records into one cell.

This example is a very long list, but I showed just several records.

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
Book1
ABCDEFGHI
1
2Rank (2016)MunicipalityProvincePopulation (2016)
31TorontoOntario2,731,571CriteriaMunicipality
42MontrealQuebec1,704,694AlbertaCalgaryCalgary, Edmonton, Red Deer, Strathcona County, Lethbridge, Wood Buffalo, St. Albert, Medicine Hat, Grande Prairie, Airdrie
53CalgaryAlberta1,239,220Edmonton
64OttawaOntario934,243Red Deer
75EdmontonAlberta932,546Strathcona County
86MississaugaOntario721,599Lethbridge
97WinnipegManitoba705,224Wood Buffalo
108VancouverBritish Columbia631,486St. Albert
119BramptonOntario593,638Medicine Hat
1210HamiltonOntario536,917Grande Prairie
1311Quebec CityQuebec531,902Airdrie
Sheet15
Cell Formulas
RangeFormula
H4=FILTER(T_Pop[Municipality],T_Pop[Province]=G4)
I4=TEXTJOIN(", ",,IF(G4=T_Pop[Province],T_Pop[Municipality],""))
<strike></strike>
[/FONT]
 
Last edited:
Upvote 0
There are many ways. The simplest is to use the new function FILTER (available in Excel 365) to extract and list the records according to a specified criteria. You can also use function TEXTJOIN to extract the records into one cell.

This example is a very long list, but I showed just several records.

ABCDEFGHI
1
2Rank (2016)MunicipalityProvincePopulation (2016)
31TorontoOntario2,731,571CriteriaMunicipality
42MontrealQuebec1,704,694AlbertaCalgaryCalgary, Edmonton, Red Deer, Strathcona County, Lethbridge, Wood Buffalo, St. Albert, Medicine Hat, Grande Prairie, Airdrie
53CalgaryAlberta1,239,220Edmonton
64OttawaOntario934,243Red Deer
75EdmontonAlberta932,546Strathcona County
86MississaugaOntario721,599Lethbridge
97WinnipegManitoba705,224Wood Buffalo
108VancouverBritish Columbia631,486St. Albert
119BramptonOntario593,638Medicine Hat
1210HamiltonOntario536,917Grande Prairie
1311Quebec CityQuebec531,902Airdrie

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet15

Worksheet Formulas
CellFormula
H4=FILTER(T_Pop[Municipality],T_Pop[Province]=G4)
I4=TEXTJOIN(", ",,IF(G4=T_Pop[Province],T_Pop[Municipality],""))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

<strike></strike>

I don't have Excel 365.

I tried using the textjoin function but it didn't work. What is the T_Pop part of your formula?
 
Upvote 0
The ExcelTable containing the data is called T_Pop. Try invoking the TEXTJOIN formula with Ctrl+Shift+Enter, since it contains an array. If TEXTJOIN doesn't work, your Excel version is old.
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,038
Members
448,940
Latest member
mdusw

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