smaller equations: a & b, or just a..

N

nastech

don't know it this can work, but
i have working, long equations that break down into basically 3parts:
If switch is set, then a & b, else just a. That is a repetition I am trying
to get rid of.

basically have: =IF($ab$2="x",AND(A=C,B=C),A=C)

trying to get rid of using a=c twice, thanks..
(a can stand alone, but b must be anded with a)
maybe something like:
=AND(A=C,IF($ab$2="x",b=c)) but 2nd part comes up as false, so not work..
=AND(A=C,IF($ab$2<>"x","",b=c)
 
D

Dana DeLouis

trying to get rid of using a=c twice

I think if you factor out a=c, it reduces to this:

=AND(a=c,OR(b=c, $ab$2<>"x") )

Hope I got it right :>)
 
J

joeu2004

nastech said:
i have working, long equations [...].
basically have: =IF($ab$2="x",AND(A=C,B=C),A=C)
trying to get rid of using a=c twice

You do not explain why. If you merely want to avoid typing,
any of the methods suggested so far will suffice. But you
might also want consider the cost of evaluating formulas
unnecessarily, if they are "long equations" or invoke costly
functions. To minimize that, I believe you want to stick with
the IF() form, but change the order of testing.

=if(A=C, or(B=C, $ab$2<>"x"), false)

When A=C is false, that avoids evaluating B=C while also
reducing typing. Even more efficient:

=if(A=C, if($ab$2<>"x", true, B=C), false)

The point is: AND() and OR() functions evaluate all
parameters, whereas IF() evaluates only the appropriate
true-part or false-part depending on the value of the
conditional expression. Arguably, usually it is not a big deal.
 
N

nastech

Thanks-all ! ! These answers all look good, and should all be right, as was
wondering about use of true/false in equations, and have not tried any of
them yet. (particular version my application the only choice left)

sorry if I left anything out I could have included, thought of the
following, but it may not matter? long-legs includes tests of same item from
mulitple locations, placed in a conditional format (for which this question
surrounds). For items that I "have" to test, the space required of 257/258
characters was a constraint. Thanks.
 
N

nastech

060129: smaller equations: a & b, or just a..
Thanks-all ! ! These answers all look good, and should all be right, as was
wondering about use of true/false in equations, and have not tried any of
them yet. (particular version my application the only choice left)

sorry if I left anything out I could have included, thought of the
following, but it may not matter? long-legs includes tests of same item from
mulitple locations, placed in a conditional format (for which this question
surrounds). For items that I "have" to test, the space required of 257/258
characters was a constraint. Thanks.
 
N

nastech

060129: smaller equations: a & b, or just a..
Thanks-all ! ! These answers all look good, and should all be right, as was
wondering about use of true/false in equations, and have not tried any of
them yet. (particular version my application the only choice left)

sorry if I left anything out I could have included, thought of the
following, but it may not matter? long-legs includes tests of same item from
mulitple locations, placed in a conditional format (for which this question
surrounds). For items that I "have" to test, the space required of 257/258
characters was a constraint. Thanks.


nastech said:
i have working, long equations [...].
basically have: =IF($ab$2="x",AND(A=C,B=C),A=C)
trying to get rid of using a=c twice

You do not explain why. If you merely want to avoid typing,
any of the methods suggested so far will suffice. But you
might also want consider the cost of evaluating formulas
unnecessarily, if they are "long equations" or invoke costly
functions. To minimize that, I believe you want to stick with
the IF() form, but change the order of testing.

=if(A=C, or(B=C, $ab$2<>"x"), false)

When A=C is false, that avoids evaluating B=C while also
reducing typing. Even more efficient:

=if(A=C, if($ab$2<>"x", true, B=C), false)

The point is: AND() and OR() functions evaluate all
parameters, whereas IF() evaluates only the appropriate
true-part or false-part depending on the value of the
conditional expression. Arguably, usually it is not a big deal.
 
Top