Thread: If Then Else
View Single Post
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Pixie Pixie is offline
external usenet poster
 
Posts: 16
Default If Then Else

Hello!

macropod wrote me a great statement for displaying the last 4 digits of a
16-digit account number - see below:

It works great but only if there is an account number in the field. It turns
out that sometimes there isn't an account number in the field and I get a
syntax error. I want to use an If Then Else statement to use the code if
there is an account number but leave the field blank if there isn't an
account number. I'm not sure how to do it. The Help is written to display
"text" or not and I'm not sure how to deal with quotes and brackets.

Thanks as always for your help!

(QUOTE{SET Data {MERGEFIELD myfield}}{=MOD({=INT({REF Data}/100)-1},100)+1 \
#00}}
{IF{REF Data }= "*1?" 1 {IF{REF Data }= "*2?" 2 {IF{REF Data }= "*3?" 3
{IF{REF Data }= "*4?" 4 {IF{REF Data }= "*5?" 5 {IF{REF
Data }= "*6?" 6 {IF{REF Data }= "*7?" 7 {IF{REF Data }= "*8?" 8 {IF{REF Data
}= "*9?" 9 0}}}}}}}}}
{IF{REF Data }= "*1" 1 {IF{REF Data }= "*2" 2 {IF{REF Data }= "*3" 3 {IF{REF
Data }= "*4" 4 {IF{REF Data }= "*5" 5 {IF{REF Data }=
"*6" 6 {IF{REF Data }= "*7" 7 {IF{REF Data }= "*8" 8 {IF{REF Data }= "*9" 9
0}}}}}}}}}}