IF cell contains / does not contain

surkdidat

Well-known Member
Joined
Oct 1, 2011
Messages
594
Office Version
  1. 365
Apologies

My brain is not working this Monday morning!

Can someone please help and translate the following into a formula :)

IF B1 CONTAINS "cat" AND c14= "CR" then display "NA",

IF B1 CONTAINS "dog" AND c9 DOES NOT CONTAIN "dog", then display "NA"

Otherwise display "1"

Many thanks
 
Your question is not clear in Post # 9.

try if this works for you

=IF(OR(AND(ISNUMBER(SEARCH("cat",B1)),C14="CR",ISERR(SEARCH(B1,C9))),AND(ISNUMBER(SEARCH("dog",B1)),ISERR(SEARCH("dog",C9)))),"NA",1)
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi

To clarify:-

Where I have the formula
Code:
=IF(OR(AND(ISNUMBER(SEARCH("cat",B1)),C14="CR"),AND(ISNUMBER(SEARCH("dog",B1)),ISERR(SEARCH("dog",C9)))),"NA",1)

This works perfectly, apart from I forgot part of my logic!

Into the above formula, I need it to also look at cell C9. In this cell will be a word, such as "Flap". I then need it to look in B1 and see if it contains "CAT" and also the value of c9. If it contains BOTH, I need it to return a "1" value. If it contains "CAT" in B1, and anything other than the text in C9, I want it to return "NA".

I did try the following code, but it reverses the result, ie returns a ! winstead of a "NA", and a "NA" instead of a "1"

Code:
AND(ISNUMBER(SEARCH($I$13,B1)),ISERR(SEARCH(B1,$I$13)))),



Your question is not clear in Post # 9.

try if this works for you

=IF(OR(AND(ISNUMBER(SEARCH("cat",B1)),C14="CR",ISERR(SEARCH(B1,C9))),AND(ISNUMBER(SEARCH("dog",B1)),ISERR(SEARCH("dog",C9)))),"NA",1)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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