Can I use IF statements, and still use switches?

C

Curt

Here is my problem.
My business manager is merging an excel file and word
file. The specific field is for teachers to get paid more
if they do extra duty. In one field, instead of staying
blank (like it is in excel, no data in that cell) it
turns into a "0" in the word merge field.
Is there any way that I can run an IF statement to check
to see if the 0 is going to show up in word, and if it
is, to leave the space blank, but if there is something
that is supposed to show up there, format it using this
switch - "\# $#,0.00"
I tried doing { IF {Mergefield Description_ED_1} = "0" ""
{mergefield Extra_Duty_1 \# $#,0.00}}
When I tried this, it just returns "Mergefield" in the
Word printout for that space.
I'm using Office XP
Any help would be greatly appreciated. I'm stumped.
Thanks in Advance.
Curt Vlaminck
 
G

Graham Mayor

The conditional field you use will work provided you insert the field
boundaries with CTRL+F9 and not typed from the keyboard as you appear to
have done.

Presumably if the Extra_Duty_1 field result is 0 when there is no extra duty
then that field on its own would do the trick without need for the
condition.

{Mergefield Extra_Duty_1\# "$,0.00;;}

will only display an amount greater than 0


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

Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
G

Guest

Thanks a lot! That seemed to do the trick. What did this
part of the code do though? "$,0.00;;} I'm just confused
but the pair of double quotes, and the double semicolon.
Thanks for your help!
 
G

Graham Mayor

Minor typo there - sorry :(
It should have read
\# "$,0.00;;"

The two semi colons at the end determine what happens with negative numbers
and zeros. To understand the principle see

\# "$,0.00;negative;zero"

In other word for a number greater than zero the result is formatted as
$,0.00
For numbers less than zero - the number is formatted as negative - in this
case "negative" will be typed
For a result of zero - the number is formatted as zero - and again in this
example will be type as "zero"

Lets say you have a data file with a single field called 'Number', which
contains the following
-1
0
1

Merging with
{Mergefield Number \# "$,0.00;negative;zero"}
will result in
negative
zero
$1.00

Does that help?

Thus if your field had a zero result the original suggestion would produce a
blank without the need for a conditional field.

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

Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 

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