find different words, and act different by finding them

danielhollander

New Member
Joined
Oct 25, 2018
Messages
3
Hi!


My problem is the following.


In cell L2 is a sentence that can contain 4 different words. The function first need to find the word, then act on it.


As exampel:


text WW text text text
text text XX text text
YY text text text
text text text ZZ


When cell l2 contains WW, cell M2 need to say WW
When cell l2 contains XX, cell M2 need to say XX
When cell l2 contains YY, cell M2 need to say YY
When cell l2 contains ZZ, cell M2 need to say ZZ


Hopefully someone understands, and help me.


Many thanks!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
A​
B​
C​
2​
text WW text text textWWB2: =LOOKUP(9999, SEARCH({"WW","XX","YY","ZZ"}, A2), {"WW","XX","YY","ZZ"})
3​
text text XX text textXX
4​
YY text text textYY
5​
text text text ZZZZ
 
Last edited:
Upvote 0
Hi,

Similar to shg's, just using a List/Table for the keywords:


Book1
LMN
2text WW text text textWWWW
3text text XX text textXXXX
4YY text text textYYYY
5text text text ZZZZZZ
Sheet350
Cell Formulas
RangeFormula
M2=LOOKUP(2,1/SEARCH(N$2:N$5,L2),N$2:N$5)
 
Upvote 0
Hi,

Similar to shg's, just using a List/Table for the keywords:

LMN
2text WW text text textWWWW
3text text XX text textXXXX
4YY text text textYYYY
5text text text ZZZZZZ

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

Worksheet Formulas
CellFormula
M2=LOOKUP(2,1/SEARCH(N$2:N$5,L2),N$2:N$5)

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

<tbody>
</tbody>

Thanks the column can recognize if the words are in the sentence now. He put a 0 if those words are found.

I want the column to repeat the word he found. Do you have a solution for that?
 
Upvote 0
A​
B​
C​
2​
text WW text text textWWB2: =LOOKUP(9999, SEARCH({"WW","XX","YY","ZZ"}, A2), {"WW","XX","YY","ZZ"})
3​
text text XX text textXX
4​
YY text text textYY
5​
text text text ZZZZ

<tbody>
</tbody>

What do you mean with "9999".
Does this lookup repeat the words found?
 
Upvote 0
Both shg and my formula returns the Word that is found, I don't know what you mean by:

He put a 0 if those words are found.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,750
Messages
6,132,500
Members
449,730
Latest member
SeanHT

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