0

I am trying to search for multiple items in a cell. If any of the terms I am looking for is present, I want cell D to display "Laptop", otherwise, display "Desktop". I can get the following to work, with just one term to search for:

=IFERROR(IF(SEARCH("blah",A2),"Laptop",""),"Desktop")

But I want to search for the presence of blah, blah2, and blah3. I don't know how to get Excel to search for any of the following terms. (Not all of them mind you, just any of the following.

I did see that there is an or option for the logic.

=OR(first condition, second condition, …, etc.)

I am not sure how to get these two to work together. Any thoughts on how to get them to display "Laptop" if any of the words are present?

CS3000911
  • 131
  • 2
  • 2
  • 8

2 Answers2

0

You could use the combination of OR, IFERROR and SEARCH as you suggest, but I think the simpler construct would be ...

=IF(AND(ISERROR(SEARCH("value1",A2)),ISERROR(SEARCH("value2",A2))),"Desktop","Laptop")

MattClarke
  • 1,647
  • 1
  • 11
  • 32
0

This should work:

=IF(SUM(COUNTIF(A2,"*" &{"blah1";"blah2";"blah3"}& "*"))>0,"laptop","desktop")
Doug Glancy
  • 27,214
  • 6
  • 67
  • 115