Microsoft KB Archive/70131

= WD: Example IF Fields for Print Merging in Word for Windows =

Article ID: 70131

Article Last Modified on 11/16/2006

-

APPLIES TO


 * Microsoft Word 1.1 Standard Edition
 * Microsoft Word 1.1 Standard Edition
 * Microsoft Word 2.0 Standard Edition
 * Microsoft Word 2.0a
 * Microsoft Office Word 2003
 * Microsoft Word 2.0c
 * Microsoft Word 6.0 Standard Edition
 * Microsoft Word 6.0a
 * Microsoft Word 6.0c
 * Microsoft Word 95 Standard Edition
 * Microsoft Word 95a
 * Microsoft Word 97 Standard Edition

-



This article was previously published under Q70131



The following are examples of IF statements for print merging and the logic for each statement.

   {if {party}=&quot;R&quot; &quot;Republican&quot; &quot;Democrat or Other&quot;} If &quot;party&quot; is equal to &quot;R&quot;, enter &quot;Republican&quot; (first option is positive). If it is not equal to &quot;R&quot;, enter &quot;Democrat&quot; or &quot;Other&quot; (second option is negative).    {name} {if{party}<>&quot;R&quot; &quot;&quot; &quot;Republican &quot;}{City} If &quot;party&quot; is not equal to &quot;R&quot;, enter nothing. If &quot;party&quot; is equal to &quot;R&quot;, enter &quot;Republican&quot;. This line will also suppress the blank line left by a non-R result.    {if{party}=&quot;R&quot; &quot;Republican&quot; {if{party&quot;=&quot;D&quot; &quot;Democrat&quot;} {if {party} =&quot;O&quot; &quot;Other&quot;}} If &quot;party&quot; is equal to &quot;R&quot;, enter &quot;Republican&quot;. If &quot;party&quot; is &quot;D&quot;, enter &quot;Democrat&quot;. If &quot;party&quot; is equal to &quot;O&quot;, enter &quot;Other&quot;. If &quot;party&quot; is none of these, it will be blank.    {if{party}=&quot;R&quot; &quot;{party}epublican and family&quot; {if{party}=&quot;D&quot; &quot;{party}emocrat and relatives&quot; {if{party}=&quot;O&quot; &quot;{party}ther&quot;}}} If &quot;party&quot; is equal to &quot;R&quot; then enter the value of &quot;party&quot; and &quot;epublican and family&quot;. If &quot;party&quot; is equal to &quot;D&quot; then enter the value of &quot;party&quot; and &quot;emocrat and relatives&quot;. If &quot;party&quot; is equal to &quot;O&quot; enter the value of &quot;party&quot; and &quot;ther&quot;. If &quot;party&quot; is not &quot;D&quot;, &quot;R&quot;, or &quot;O&quot;, it will be blank.    {if{party}=&quot;R&quot; {if{name}=&quot;George Bush&quot; {if{city}=&quot;Washington D.C.&quot; &quot;President&quot;}}} If &quot;party&quot; is equal to &quot;R&quot; and &quot;name&quot; is &quot;George Bush&quot; and &quot;city&quot; is &quot;Washington D.C.&quot;, enter &quot;President&quot;. If all the conditions aren't met leave it blank. 

Sample Data Document
NAME,PARTY,CITY

George Bush,R,Washington D.C.

George McGovern,D,Rapid City

Gorgeous George,O,Hollywood

King George,K,London

Special Note: Field codes and bookmarks are not case sensitive; for example, NAME would print merge to {naME}. However the results are case sensitive. In these examples if the codes said {if {party}=&quot;r&quot; &quot;Republican&quot;} and the data document had the &quot;r&quot; capitalized (R), it would be considered to be a non-r and print nothing.

Additional query words: 6.0 winword2 word6 word7 winword 7.0 word95 word97

Keywords: kbualink97 kbmerge kbfield kbusage KB70131

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.