ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   search for multiple strings (https://www.excelbanter.com/excel-discussion-misc-queries/245696-search-multiple-strings.html)

Lea from CA[_2_]

search for multiple strings
 
Here is my current formula =IF(ISERROR(SEARCH("move",D4)),0,E4). Now I want
to also search for "carryforward" in cell D4. How can I do that?

Dave Peterson

search for multiple strings
 
Add another =search() to your formula.

But the next question is--what do you want to check for:
either/or/or both
Either/or, but not both (exactly one)
or none

=if(and(iserror(search("carryforward",d4)),ISERROR (SEARCH("move",D4))),
"neither","at least one")

You may want to use =isnumber() instead of =iserror(). That'll be true if the
string is in the cell.

And you may want to use =Or() instead of =And() in the formula.



Lea from CA wrote:

Here is my current formula =IF(ISERROR(SEARCH("move",D4)),0,E4). Now I want
to also search for "carryforward" in cell D4. How can I do that?


--

Dave Peterson

Gary Brown[_5_]

search for multiple strings
 
=IF(AND(ISERROR(SEARCH("move",D4)),ISERROR(SEARCH( "carryforward",D4))),0,E4)
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Lea from CA" wrote:

Here is my current formula =IF(ISERROR(SEARCH("move",D4)),0,E4). Now I want
to also search for "carryforward" in cell D4. How can I do that?


Domenic[_2_]

search for multiple strings
 
In article ,
Lea from CA wrote:

Here is my current formula =IF(ISERROR(SEARCH("move",D4)),0,E4). Now I want
to also search for "carryforward" in cell D4. How can I do that?



Here's another way...

=IF(OR(ISNUMBER(SEARCH({"move","carryforward"},D4) )),E4,0)

--
Domenic
Microsoft Excel MVP
www.xl-central.com
Your Quick Reference to Excel Solutions

Lea from CA[_2_]

search for multiple strings
 
It works! Thank you so much!

"Gary Brown" wrote:

=IF(AND(ISERROR(SEARCH("move",D4)),ISERROR(SEARCH( "carryforward",D4))),0,E4)
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Lea from CA" wrote:

Here is my current formula =IF(ISERROR(SEARCH("move",D4)),0,E4). Now I want
to also search for "carryforward" in cell D4. How can I do that?



All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com