IF(OR FUNCTION

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The following formula works okay for me, but I want o expand the statement to
include two more names, ie. I want the same results that I get when "DUNN"
is entered for "JANE" and "THOMPSON". How can I connect them?

=IF(OR(D14,D15="DUNN")*AND(D10,D11="DUNN"),"VIOLATION!","")

Any help is appreciated.

Renee
 
I don't understand your current formula. What is D14 and D10 supposed to
represent. The IF statement using OR has no condition to meet for D14. But
with the way you have it set up, I would assume something like:

=IF(OR(D14,D15="DUNN",D15="JANE",D15="THOMPSON")*AND(D10,D11="DUNN",D11="JANE",D11="THOMPSON"),"VIOLATION!","")

HTH,
Paul
 
Renee said:
The following formula works okay for me, but I want o expand the statement
to include two more names, ie. I want the same results that I get when
"DUNN" is entered for "JANE" and "THOMPSON". How can I connect them?
=IF(OR(D14,D15="DUNN")*AND(D10,D11="DUNN"),"VIOLATION!","")

The OR() condition is true when D14 is non-zero (i.e. not FALSE) or D15
contains "DUNN". The AND() condition is true when D10 is non-zero and
D11 contains "DUNN". So you could write:

=if(or(D14,D15="DUNN",D15="JANE",D15="THOMPSON") *
and(D10,or(D11="DUNN",D11="JANE","THOMSPON")), "VIOLATION!", "")
 
PS....
=if(or(D14,D15="DUNN",D15="JANE",D15="THOMPSON") *
and(D10,or(D11="DUNN",D11="JANE","THOMSPON")), "VIOLATION!", "")

It just occurred to me.... Since you are accustomed to
OR(...)*AND(...) instead of the more customary AND(OR(...),AND(...)),
you could avoid the nested AND(...,OR(...)) above by doing the
following:

=if(or(D14,D15="DUNN",D15="JANE",D15="THOMPSON") * (D10<>0) *
or(D11="DUNN",D11="JANE","THOMSPON"), "VIOLATION!", "")

Of course, you could really go crazy and replace OR() with an
expression using "+". But I think that's taking the paradigm too far
in this context. Either of the above do not sacrifice readability,
IMHO.
 
Back
Top