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

Hi Blue Hornet,

I geuss, your formula could be slightly more efficient if you used the fixed
arrays:

=IF(OR(A4={"apple","pear","plum"}),"fruit",IF(OR(A 4={"carrot","bean"}),"veg",IF(OR(A4={"bun","cake", "donut"}),"pastry",A4)))

Regards,
KL

"Blue Hornet" wrote in message
oups.com...
I'm with Ken Wright and his answer below, but you did express a wish to
understand the use of "AND", "OR" and (though you didn't say it) "NOT"
in IF statements. So ...

=IF( OR( A4 = "apple", A4 = "pear", A4 = "plum"), "fruit", IF( OR( A4 =
"carrot", A4 = "bean"), "veg", IF( OR( A4 = "bun", A4 = "cake", A4 =
"donut"), "pastry", "who knows?")))

To use AND you'd use the same general construct:
=if ( and( A4 = "apple", B4 = "fruit"), "apple fruit", "not apple
fruit")

NOT works the same.

Chris