Combine ISNUMBER SEARCH with AND function

Craig__

Board Regular
Joined
Feb 16, 2010
Messages
66
Hi guys

I just can’t seem to work this one out. Your help would be most appreciated.

Is it possible to combine the AND function with the following formula?

=IF(ISNUMBER(SEARCH("high",A5)),1,IF(ISNUMBER(SEARCH("moderate",A5)),1,""))

Something like this:
=IF(AND(ISNUMBER(SEARCH("high",A5)),1,IF(ISNUMBER(SEARCH("moderate",A5)),C5>"",1,"")))

What I want is a formula that says:
If A5 is found to contain the word high or moderate, and C5 is not empty, then display a value of 1, otherwise display nothing.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
And() is usually very finicky (I learned the hard way when I was trying to learn arrays, but the "+" sign works better for or, and the "*" for and.

Code:
=IF((ISNUMBER(SEARCH("moderate",A2)))+(ISNUMBER(SEARCH("high",A2))),1,"")
 
Upvote 0
Hi guys

I just can’t seem to work this one out. Your help would be most appreciated.

Is it possible to combine the AND function with the following formula?

=IF(ISNUMBER(SEARCH("high",A5)),1,IF(ISNUMBER(SEARCH("moderate",A5)),1,""))

Something like this:
=IF(AND(ISNUMBER(SEARCH("high",A5)),1,IF(ISNUMBER(SEARCH("moderate",A5)),C5>"",1,"")))

What I want is a formula that says:
If A5 is found to contain the word high or moderate, and C5 is not empty, then display a value of 1, otherwise display nothing.
Try this...

=IF(AND(C5<>"",COUNT(SEARCH({"high","moderate"},A5))),1,"")
 
Upvote 0
Many thanks Salim and T.Valko for your advice and help. T.Valko, your formula works perfectly. Just what I needed. Much appreciated.

Craig
 
Upvote 0
Trying to do this in excel,the box N3 can contain more than just Ok or Rotten so i need to do a keyword search.

If P3 quals Bananna and N3 contains "Ok" then AD3="Eat"
If P3 quals Bananna and N3 contains "Rotten" then AD3="Dont eat"
If P3 quals Apple and N3 contains "Ok" then AD3="Eat"
If P3 quals Apple and N3 contains "Rotten" then AD3="Dont eat"

This all needs to be on a single forumla :(

hope someone can help

thanks

dave
 
Upvote 0
Trying to do this in excel,the box N3 can contain more than just Ok or Rotten so i need to do a keyword search.

If P3 quals Bananna and N3 contains "Ok" then AD3="Eat"
If P3 quals Bananna and N3 contains "Rotten" then AD3="Dont eat"
If P3 quals Apple and N3 contains "Ok" then AD3="Eat"
If P3 quals Apple and N3 contains "Rotten" then AD3="Dont eat"

This all needs to be on a single forumla :(

hope someone can help

thanks

dave

Try...
Rich (BB code):
=IF(OR(P3={"Bananna","Apple"}),
    IF(N3="Ok","Eat",IF(N3="Rotten","Don't Eat","")),
    "")
 
Upvote 0
Sorry, it should be

If P3 quals Bananna and N3 contains "Ok" then AD3="Eat 1"
If P3 quals Bananna and N3 contains "Rotten" then AD3="Dont eat 1"
If P3 quals Apple and N3 contains "Ok" then AD3="Eat 2"
If P3 quals Apple and N3 contains "Rotten" then AD3="Dont eat 2"

There are 4 outcomes :)

This all needs to be on a single forumla :(

hope someone can help

thanks

dave
 
Upvote 0
Sorry, it should be

If P3 quals Bananna and N3 contains "Ok" then AD3="Eat 1"
If P3 quals Bananna and N3 contains "Rotten" then AD3="Dont eat 1"
If P3 quals Apple and N3 contains "Ok" then AD3="Eat 2"
If P3 quals Apple and N3 contains "Rotten" then AD3="Dont eat 2"

There are 4 outcomes :)

This all needs to be on a single forumla :(

hope someone can help

thanks

dave

Set up a range like below, say in A2:C5...

<TABLE style="WIDTH: 174pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=232><COLGROUP><COL style="WIDTH: 48pt" span=2 width=64><COL style="WIDTH: 78pt; mso-width-source: userset; mso-width-alt: 3697" width=104><TBODY><TR style="HEIGHT: 14.4pt" height=19><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 14.4pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=19 width=64> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 width=64> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; WIDTH: 78pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 width=104> </TD></TR><TR style="HEIGHT: 14.4pt" height=19><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 14.4pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=19>Bananna</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>Ok</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>Eat 1</TD></TR><TR style="HEIGHT: 14.4pt" height=19><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 14.4pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=19>Bananna</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>Rotten</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>Don't eat 1</TD></TR><TR style="HEIGHT: 14.4pt" height=19><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 14.4pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=19>Apple</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>Ok</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>Eat 2</TD></TR><TR style="HEIGHT: 14.4pt" height=19><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 14.4pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=19>Apple</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>Rotten</TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65>Don't eat 2</TD></TR><TR style="HEIGHT: 14.4pt" height=19><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 14.4pt; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=19> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65> </TD><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext; BACKGROUND-COLOR: transparent; BORDER-TOP: windowtext; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65> </TD></TR></TBODY></TABLE>

Now you can invoke...

Control+shift+enter, not just enter:
Rich (BB code):
=INDEX($C$2:$C$5,MATCH(N3,IF($A$2:$A$5=P3,$B$2:$B$5),0))
If you don't want to set up such a table...

Control+shift+enter, not just enter:
Rich (BB code):
=INDEX({"Eat 1";"Don't eat 1";"Eat 2";"Don't eat 2"},
  MATCH(N3,IF({"Bananna";"Bananna";"Apple";"Apple"}=P3,
   {"Ok";"Rotten";"Ok";"Rotten"}),0))
 
Upvote 0
thank you so much, just need to find out how to keyword search one of the reference boxes as it contains extra info. im sure you use the SEARCH function but not sure on these array things :)

dave
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,723
Members
452,939
Latest member
WCrawford

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