How to check for multiple keywords on a text and return back one or more creteria

irman

New Member
Joined
Aug 25, 2017
Messages
3
Hi Guys

I am looking for a formula to help me like the below example

[TABLE="width: 500"]
<tbody>[TR]
[TD]brown, blue, green, black [/TD]
[TD] if Cell A1 contain Blue and black and green return X1 in Cell B1 [/TD]
[/TR]
[TR]
[TD]Car, Black, Battery, Monitor [/TD]
[TD] if Cell A2 contain Black and battery and car return X2 in Cell B2[/TD]
[/TR]
[TR]
[TD] Apple, Carnot, blue, brown[/TD]
[TD]if Cell A3 contain Apple and carrot and car return X3 in Cell B3[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Try...

Code:
=AND(ISNUMBER(SEARCH(","&{"blue","black","green"}&",",","&SUBSTITUTE(SUBSTITUTE(A1,", ",",")," ,",",")&",")))

or

Code:
=AND(ISNUMBER(SEARCH(","&G1:I1&",",","&SUBSTITUTE(SUBSTITUTE(A1,", ",",")," ,",",")&",")))

...where G1:I1 contains the colors of interest, such as blue, black and green. Note that the second formula needs to be confirmed with CONTROL+SHIFT+ENTER. Also, note that both formulas deal with situations where the data contains extra or no spaces, such as the following...

Code:
brown,blue,green,black
brown ,blue , green, black
etc...

Hope this helps!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
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