given a reference of data, Extract Text from one cell

dodo1051

New Member
Joined
Oct 17, 2018
Messages
3
so i have a cell contains text string and i want to extract out the string with the reference i have,
i know we can use FIND or SEARCH but i only know to use it for a text string not a range of cell.

So from column A,
Reference data is D1:D3
to column B

Code:
_____________A________________B__________C__________D__________
|1|Apple, Pineapple, Tiger | Tiger    |    |Cat
|2|Mantis, Card, Table     | Mantis   |    |Tiger
|3|Pineapple, Cat, Card    | Cat      |    |Mantis
|4|
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi. Try to paste data directly from excel as we can then copy and paste it back to excel. That said this should work for you, place in B1 and drag down:

=INDEX($D$1:$D$3,MATCH(TRUE,INDEX(ISNUMBER(SEARCH($D$1:$D$3,A1)),0),0))
 
Upvote 0
And heres a slightly more complex one which gets rid of the potentially incorrect results which may occur with apple and pineapple:

=INDEX($D$1:$D$3,MATCH(TRUE,INDEX(ISNUMBER(SEARCH(","&$D$1:$D$3&",",SUBSTITUTE(","&A1&","," ",""))),0),0))
 
Upvote 0
Hi,

Another option, Use B1 formula or C1 formula for in case there's no match found, either formula copied down.


Book1
ABCD
1Apple, Pineapple, TigerTigerTigerCat
2Mantis, Card, TableMantisMantisTiger
3Pineapple, Cat, CardCatCatMantis
Sheet331
Cell Formulas
RangeFormula
B1=LOOKUP(2,1/SEARCH(" "&D$1:D$3&","," "&A1&","),D$1:D$3)
C1=IFERROR(LOOKUP(2,1/SEARCH(" "&D$1:D$3&","," "&A1&","),D$1:D$3),"")
 
Upvote 0
You're welcome, from a month ago...
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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