extract text from a sentence (in a cell) based on a list

ExcelNewbie2020

Active Member
Joined
Dec 3, 2020
Messages
333
Office Version
  1. 365
Platform
  1. Windows
Sirs,

How can I extract text based on the list. see below
I would like to extract the animal name in the sentence and put it in the other cell.. thanks
descriptionformula resultanimal list
the quick brown fox jump over the lazy dogfox, dogfox
the goat and a chicken try to cross a weak and narrow bridge across the rivergoat, chickendog
goat
chicken
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try:

Book1
ABCDE
1DescriptionFormula ResultAnimal List
2The quick brown fox jumps over the lazy dogfox, dogfox
3The goat and a chicken try to cross a weak and narrow bridge across the rivergoat, chickendog
4goat
5chicken
Sheet1
Cell Formulas
RangeFormula
B2:B3B2=TEXTJOIN(", ",1,IF(ISNUMBER(SEARCH($E$2:$E$5,A2)),$E$2:$E$5,""))
 
Upvote 0
Solution
Try:

Book1
ABCDE
1DescriptionFormula ResultAnimal List
2The quick brown fox jumps over the lazy dogfox, dogfox
3The goat and a chicken try to cross a weak and narrow bridge across the rivergoat, chickendog
4goat
5chicken
Sheet1
Cell Formulas
RangeFormula
B2:B3B2=TEXTJOIN(", ",1,IF(ISNUMBER(SEARCH($E$2:$E$5,A2)),$E$2:$E$5,""))
thanks bro, it worx..
 
Upvote 0
For some reason TEXTJOIN (such an elegant solution) does not work the same way on my system (Excel 2019).


text from sentence.xlsx
ABCD
1
2the quick brown fox jump over the lazy dogfox, dog, goat, chickenfox
3
4the goat and a chicken try to cross a weak and narrow bridge across the rivergoat, chickendog
5the quick brown fox jump over the lazy dogfox, doggoat
6chicken
7
8the quick brown fox jump over the lazy dog fox
9the goat and a chicken try to cross a weak and narrow bridge across the river dog
10goat
11chicken
Sheet1
Cell Formulas
RangeFormula
B2B2=TEXTJOIN(", ",1,IF(ISNUMBER(SEARCH(D2:D6,A2)),D2:D6,""))
B4:B5B4=SUBSTITUTE(IFERROR(MID($A4,FIND($D$2,$A4,1),LEN($D$2)),"")&", "&IFERROR(MID($A4,FIND($D$4,$A4,1),LEN($D$4)),"")&", "&IFERROR(MID($A4,FIND($D$5,$A4,1),LEN($D$5)),"")&", "&IFERROR(MID($A4,FIND($D$6,$A4,1),LEN($D$6)),""),CHAR(44)&CHAR(32)&CHAR(44)&CHAR(32),"")
B8B8=TEXTJOIN(", ",1,IF(ISNUMBER(SEARCH($D$2:$D$6,A8)),$D$2:$D$6,""))
B9B9=TEXTJOIN(", ",1,IF(ISNUMBER(SEARCH($D$8:$D$11,A9)),$D$8:$D$11,""))



thanks bro, it worx..
 
Upvote 0
For some reason TEXTJOIN (such an elegant solution) does not work the same way on my system (Excel 2019).
The TEXTJOIN should work on your system too. The difference is that on 2019, you need to array enter the formula. When you enter the formula, use Control+Shift+Enter instead of just Enter.
 
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