Using a IF AND statement in Word Fields

S

SG Luke

Hi, I am attempting to us a IF AND statement in Word fields. I am simply
trying to say if A is 0 and B is > 0, Display the following, else move onto
the next logic statement. I tried using the following:
{ IF { = AND ( { MERGEFIELD a } = 0.00, { MERGFIELD b } > 0.00) "True"
"False"}

I have also tried it as
{ IF { = AND ( { COMPARE { MERGEFIELD a } = 0.00},{ COMPARE { MERGFIELD b }
0.00}) "True" "False"}

Neither way has worked. Does anyone have any idea as to where I am going
wrong?

Thanks!
 
G

Graham Mayor

Hmmm. If Mergefield A = 0 this calculation will give 0 and a False result?
Mergefield A = 0 is a required option and should result in True.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

Not being a mathematician, does multiplication have any intrinsic merit over
addition? ;)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
P

Peter Jamieson

No.

Multiplication might seem a more natural equivalent to a logical "AND"
operator to some.

An advantage of multiplication over addition is that you can extend the
number of terms involved, e.g. if R1, R2,...,Ri,...,Rn can only be 0 or
1 then

{ =R1*R2*...*Rn } must be 0 or 1

whereas

{ =R1+R2+...+Rn } can be any value between 0 and n

If you are testing for 0, it doesn't make much difference. If you are
testing for 1 (or n), then multiplication has the theoretical advantage
that you only need to compare with "1") regardless of the value of n.
With addition, you have to know what n is, i.e. how many terms are
involved. But it's not so easy to see in what circumstances that
theoretical advantage would count. If you are inserting the terms
programmatically, wouldn't you know how many you are inserting? Would
you know enough simply to inser tthe result directly instead?

Arguably, what really counts here is
a. what actually works, preferably regardless of context (e.g. the
version of Word, or "R1"s data type
b. your ability to communicate something that works to the person who
needs th information
c. an ability (yours, the OP's, others') to suggest alternatives when
something does not work as expected.

Peter Jamieson

http://tips.pjmsn.me.uk
 

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