View Single Post
  #5   Report Post  
Biff
 
Posts: n/a
Default

Well, that's a whole different animal!

Try this:

=IF(ISNUMBER(SEARCH("apples",A2)),"apples",IF(ISNU MBER(SEARCH("oranges",A2)),"oranges",""))

What if it's "apples or oranges" or "oranges or apples" ?

You'd be better off using a cell to hold the criteria:

A1 = apples
B1 = oranges

=IF(ISNUMBER(SEARCH(A1,A2)),A1,IF(ISNUMBER(SEARCH( B1,A2)),B1,""))

Biff

"jhicsupt" wrote in message
...
In cell A2, it could be "apples and pears" or it could be "oranges and
pears". What I want to do is in cell B2, just return either "apples" or
"oranges", disregarding the "and pears".

How would I do that?

Thanks for the quick response.

"Biff" wrote:

Hi!

Try one of these:

=IF(OR(A2={"apples","oranges"}),A2,"")

Biff

"jhicsupt" wrote in message
...
I would like to return a value if criteria is met.

If A2 contains the word "apples", then in cell B2, write "apples".
If A2 contains the word "oranges, then in cell B2, write "oranges".
If A2 does not contain the words "apples" or "oranges", leave the cell
blank.

Can you help me with a formula for this?

Thanks in advance.