Searching cells for certain words

nclacs99

Board Regular
Joined
Aug 23, 2012
Messages
54
Hi all, I have a column with descriptions in it. Based on the words in that column, I would like a formula to provide either the value in the next column to the left of the descriptions column or a 0. Here is an example of the formula that I tried. In this example, I would like the formula to return a 0 if EITHER the word "blah" OR "meh" is found in that cell. =IF(AND(ISNUMBER(SEARCH("qtr",H11)),ISNUMBER(SEARCH("blah",H11))),0,IF(ISNUMBER(SEARCH("qtr",H11)),G11,IF(AND(ISNUMBER(SEARCH("qtr",H11)),ISNUMBER(SEARCH("meh",H11))),0,IF(ISNUMBER(SEARCH("qtr",H11)),G11,0)))). Right now, the formula is still returning the G11 value even though the word "meh" appears in column "H". Thanks for any help!!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

ParamRay

Well-known Member
Joined
Aug 6, 2014
Messages
1,195
.
.

=IF(OR(ISNUMBER(SEARCH("blah",H11)),ISNUMBER(SEARCH("meh",H11))),0,G11)
 

nclacs99

Board Regular
Joined
Aug 23, 2012
Messages
54
Actually, I failed to mention that the formula should be looking for a certain word (or words) in that same column. For example, in the original post, I was looking for "qtr". So the formula should look for the letters "qtr" and record the value in G11, but if it sees "blah" OR "meh", then it should return a "0" value.
 

ParamRay

Well-known Member
Joined
Aug 6, 2014
Messages
1,195
.
.

So what you're saying is:

If cell H11 contains text "qtr" then formula returns value of G11; unless cell H11 contains text "blah" or "meh", in which case formula returns value 0.

What, however, should happen if cell H11 does not contain text "qtr"?
 

nclacs99

Board Regular
Joined
Aug 23, 2012
Messages
54

ADVERTISEMENT

If cell H11 does not contain text "qtr" then the formula should return a 0.
 

ParamRay

Well-known Member
Joined
Aug 6, 2014
Messages
1,195
.
.

=IF(AND(ISNUMBER(SEARCH("qtr",H11)),NOT(ISNUMBER(SEARCH("blah",H11))),NOT(ISNUMBER(SEARCH("meh",H11)))),G11,0)
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210

ADVERTISEMENT

If cell H11 does not contain text "qtr" then the formula should return a 0.

Something like:

=IFERROR(LOOKUP(9.99999999999999E+307,SEARCH("qtr",H11),G11),0)
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,114
Messages
5,835,462
Members
430,358
Latest member
zzc1128

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
Top