array formula for IF statement?

L

lindasf

Hi,

I was ok using the formula:

=IF(AND(F5="Y",G5<>"M"),"D"," ")

but then I realized that I had to check F5 for "Y" or "C" (as well a
check G5 for <> "M").

I tried an array formula, but have had no luck.

Any ideas ? Thx.

lindas
 
R

Ron Rosenfeld

Hi,

I was ok using the formula:

=IF(AND(F5="Y",G5<>"M"),"D"," ")

but then I realized that I had to check F5 for "Y" or "C" (as well as
check G5 for <> "M").

I tried an array formula, but have had no luck.

Any ideas ? Thx.

lindasf

No need for an array formula, but you can use an array constant if you want:

=IF(AND(OR(F5={"Y","C"}),G5<>"M"),"D"," ")

which is the same as:

=IF(AND(OR(F5="Y",F5="C"),G5<>"M"),"D"," ")



--ron
 
L

lindasf

Thx Ron !

I also figured out that this way works too (similar to your secon
method):

=IF(OR(F5="Y",F5="C")*AND(G5<>"M"),"D"," ")

but your first method is much more elegant! Thx.

lindas
 
R

Ron Rosenfeld

Thx Ron !

I also figured out that this way works too (similar to your second
method):

=IF(OR(F5="Y",F5="C")*AND(G5<>"M"),"D"," ")

but your first method is much more elegant! Thx.

lindasf

In general, you can use '+' for OR and '*' for AND.


--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top