Using AND statement with IF(COUNTIF or IF(ISNUMBER(SEARCH

t33ge

New Member
Joined
Sep 25, 2014
Messages
12
Hi,

I have got a formula that determines if a cell contains a certain word/text and provides me with a desired text outcome if that is the case

I have found 2 ways of doing this:

=IF(ISNUMBER(SEARCH("abc",A9)),"result","")

=IF(COUNTIF(A9,"*abc*"),"result","")

However i cant seem to figure out how to do the same for two criteria. I.e if cell A9 contains somewhere within it 'abc' and a '?' then show 'result' if it doesn't contain these 2 words then show 'noresult'

Could anyone help?

Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try

=IF(ISNUMBER(SEARCH("abc",A9)+SEARCH("abc",A9)),"result","")

=IF(COUNTIF(A9,"*abc*")+COUNTIF(A9,"?")>0,"result","")

? in COUNTIF maybe interpreted as a wildcard
Might be better to use CHAR(63) instead of "?"
 
Upvote 0
=IF(AND(ISNUMBER(SEARCH("abc",A9)), ISNUMBER(SEARCH("?", A9))),"result","")

=IF(AND(COUNTIF(A9, "*?*"), COUNTIF(A9,"*abc*")),"result","")

What is the question mark though? Because a quation mark is a wild card and you shouldn't use it like I just did in the formula. Replace the question mark with the second text you are looking for. If your formula needs the question mark for some reason, then I must have not understood your question.
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,942
Members
449,094
Latest member
teemeren

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