Search For String In Column And Return Result From Another Column

excelques2391

New Member
Joined
Jun 22, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello! I have 2 data sets:

Dataset1:
ContainerNameCollection
ContainerAFRUITS\Apple, FRUITS\banana, FRUITS\GRAPES
ContainerBFRUITS\Pears, FRUITS\oranges
ContainerCFRUITS\Apple
ContainerDFRUITS\banana

Dataset2:
Fruit
apple
BANANA
grapes
pears

For each row in Dataset2, I am looking to search in the Collection column of Dataset1 and return all of the values where a specific fruit exists. For example, from Dataset2, "apple" should return "ContainerA, ContainerC".

I tried xlookup, and while I was able to get the first result, I wasn't able to get all of the results.

In looking at the Filter function, it appears that it doesn't support wildcards, which I believe I need to account for the commas and the prefix "FRUITS\".

Is there any way to construct an Excel formula to extract this information?

Thanks!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Welcome to the Forum!

There are probably better ways, but I think this will work. Note that none of this is case-sensitive.

MrExcel posts19.xlsx
CD
5ContainerNameCollection
6ContainerAFRUITS\Apple, FRUITS\banana, FRUITS\GRAPES
7ContainerBFRUITS\Pears, FRUITS\oranges
8ContainerCFRUITS\Apple
9ContainerDFRUITS\banana
10
11fruitcontainers
12appleContainerA, ContainerC
13BANANAContainerA, ContainerD
14grapesContainerA
15pearsContainerB
Sheet27
Cell Formulas
RangeFormula
D12:D15D12=TEXTJOIN(", ",,IFERROR(IF(SEARCH(C12,$D$6:$D$9),$C$6:$C$9),""))
 
Upvote 0
Solution

Forum statistics

Threads
1,215,022
Messages
6,122,721
Members
449,093
Latest member
Mnur

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