IF statement searching for words in a cell

Mr2017

Well-known Member
Joined
Nov 28, 2016
Messages
644
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi

I know how to write a basic "IF(OR" statement.

So, for example, if cell A2 had the text "Ball" or "Racket", and we wanted to return the word "Sports," then we could write this in cell B2 =IF(OR(A2="Ball",A2="Racket"),"Sports","")

But this is restrictive, because cell A2 can ONLY contain either "Ball" or "Racket" for the statement to return "Sports."

So, I'd like to use the =IF(ISNUMBER(SEARCH function, so that if a cell contains other words in it, but still includes the words "Ball" or "Racket" then the IF statement will still return the word "Sports."

I have the words "Club, Ball" in cell A1 and I've used =IF(ISNUMBER(SEARCH("Ball",A1)),"Sports","") to return the word "Sports"

Does anyone know how I can amend this, so that it STILL returns the word "Sports" if that cell also has the word "Racket"?

Thanks in advance.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
How about
Excel Formula:
=IF(SUM(COUNTIFS(A2,{"*ball*","*Racket*"})),"Sports","")
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,039
Messages
6,122,802
Members
449,095
Latest member
m_smith_solihull

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