Searching for multiple values in a cell

jwillits

New Member
Joined
Jul 10, 2018
Messages
38
Office Version
  1. 2010
Platform
  1. Windows
I am trying to search for multiple values in a cell and if it find one of them, I would like a text value assigned to the cell. Here is my formula so far.

=IF(ISNUMBER(SEARCH(OR("ADK","DHEA"),C1)),"MMG Supplement","")

I would like it to search C1 for the text value "ADK" or "DHEA" and if it finds either, I would like it to return value "MMG Supplement.

However, it isn't working. What is wrong with my formula?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi & welcome to MrExcel
How about
=IF(OR(ISNUMBER(SEARCH("ADK",C1)),ISNUMBER(SEARCH("DHEA",C1))),"MMG Supplement","")
 
Last edited:
Upvote 0
Maybe:
=IF(OR(ISNUMBER(SEARCH({"ADK","DHEA"},C1))),"MMG Supplement","")
 
Upvote 0
Maybe:
=IF(OR(ISNUMBER(SEARCH({"ADK","DHEA"},C1))),"MMG Supplement","")


Yep, this works. The other one would have probably worked as well, but I have more than 2 text values even though my example only shows ADK and DHEA. Thanks guys!
 
Upvote 0
Yep, this works. The other one would have probably worked as well, but I have more than 2 text values even though my example only shows ADK and DHEA. Thanks guys!


It is not necessary OR in formula

=IF(ISNUMBER(SEARCH({"ADK","DHEA"},C1)),"MMG Supplement","")

but the formula will return "MMG Supplement" for any combination of letters that will contain the letters you are looking for.

With this formula also

=IF(OR(ISNUMBER(SEARCH({"ADK","DHEA"},C1))),"MMG Supplement","")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

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