WD: Using Comparison IF Statements with Text and NumbersLast reviewed: February 18, 1998Article ID: Q176769 |
The information in this article applies to:
SYMPTOMSWhen you use the mail merge IF function for comparisons, the returned data may be different from what you expect.
CAUSEThis problem will occur if a field in the data source contains text in some records and numbers in other records.
WORKAROUNDWhen 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 INFORMATIONFor information about this situation in earlier versions of Word, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q75950 TITLE : WD: Using Comparison IF Statements with Text and Numbers |
Additional query words:
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |