If Then Statements in Word If TextX=Yes, then do this. Otherwise do this....

M

Matt

I'm sure you guys get these all the time, so I apologize. I did
search through other questions and the FAQ but was unable to pin down
my exact question. It's a simple one and hopefully it will be simple
to answer.

I've got a form in Word 2002. In 1 line, I've got 2 fields. The
first is a text field with default text of Yes. The 2nd field is
supposed to do the following:

If text1 is Yes, add the two fields in the column above and multiply by
..035. This field is supposed to calculate a credit card charge if the
text field to the left says Yes to Credit Card charges.. If text1 is
No, then it should be zero. I haven't been able to figure out how
to do it, just yet. I am getting some calculations, but they're
wrong. I've tried the below with both sum(above) and sum(c1:c2) as
well as just {(c1+c2)*.035}.

If Text24=Yes {=sum(above)*.035} {0.00}}

If my logic makes sense, this should be read as "if text24=Yes, take
the sum of the fields above and multiply them by .035. Else put 0.00
in this field.

Am I missing something? Does text24 need to be a drop down box rather
than a text box?

I went ahead and tried a drop down box and it didn't seem to make a
difference.

If Dropdown1=Yes {=sum(c1:c2)*.35} {0.00}}

Thanks in advance.

Matt
 
S

Suzanne S. Barnhill

Try putting quotes around "Yes." It also can't hurt (though it shouldn't be
necessary) to put quotes around your formula field. And you need quotes
rather than field braces around the "0.00."
 
M

Matt

Thanks for the fast reply.

I've tried as you suggested:
If Text24="Yes" {=sum(above)*.035} "0.00"
If Text24="Yes" {"=sum(above)*.035"} "0.00"

The only value I can get to come back is 0.00 regardless of whether I
put in Yes or NO.

I even tried manually putting in a new bookmark called CC for Credit
Card, and using that as a reference rather than Text24. no go.

I appreciate your help.

Matt
 
S

Suzanne S. Barnhill

FWIW, the second field should be:

{ If Text24="Yes" "{=sum(above)*.035}" "0.00" }

You might also experiment with spacing in the field. Sometimes Word is picky
about spaces around operators. You definitely need one after the =; try
this:

{ If Text24 = "Yes" "{ = sum(above) * .035 }" "0.00" }

Check the Help topics "Field codes: IF field" and "Field codes: = (Formula)
field."
 
M

Matt

Thanks again Suzanne, for the help. Still not working, but that's
okay. I'll figure it out eventually.

Matt
 

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