Microsoft KB Archive/176769

= WD: Using Comparison IF Statements with Text and Numbers =

Article ID: 176769

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft Word 6.0 for Macintosh
 * Microsoft Word 6.01 for Macintosh
 * Microsoft Word 6.01 for Macintosh
 * Microsoft Word 98 for Macintosh

-



This article was previously published under Q176769



SYMPTOMS
When you use the mail merge IF function for comparisons, the returned data may be different from what you expect.



CAUSE
This problem will occur if a field in the data source contains text in some records and numbers in other records.



WORKAROUND
When the comparison is set up to select a number greater or less than another value, such as {If {MERGEFIELD number} > 70 "True condition statement" "False condition statement"}, fields that contain text will also be printed. This is because Word considers all text to have a greater "value" than numbers.

To instruct Word to return only numeric values, use a nested IF statement. One that restricts text and one that returns the correct numeric value. For example: {If {MERGEFIELD number} > 70 "{If {MERGEFIELD NUMBER} < "A"  "{MERGEFIELD number" " "} " "}

Word 6.x for the Macintosh
{If {MERGEFIELD number} > 70 "{If {MERGEFIELD NUMBER} < "A" "{MERGEFIELD number" " "} " "} The nested IF Statement requests text less than "A" and therefore returns no text in the field with text entries, and it then requests numbers greater than 70 for those records with numeric values over 70.

Word 98 Macintosh Edition
{If {MERGEFIELD number} > 70 "{If {MERGEFIELD NUMBER} < "a" "{MERGEFIELD number" " "} " "} The nested IF Statement requests text less than "a" and therefore returns no text in the field with text entries, and it then requests numbers greater than 70 for those records with numeric values over 70.



MORE INFORMATION
For information about this situation in earlier versions of Word, please see the following article in the Microsoft Knowledge Base:

75950 WD: Using Comparison IF Statements with Text and Numbers

Keywords: kbmerge kbprb kbfield KB176769

-

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

© Microsoft Corporation. All rights reserved.