WD: Using Comparison IF Statements with Text and NumbersLast reviewed: February 5, 1998Article ID: Q75950 |
The information in this article applies to:
SYMPTOMSWhen you use the print merge IF function for comparisons, the data returned may be different from what you expect.
CAUSEIn your data file, a particular field contains text with some records and numbers with other records.
MORE INFORMATIONWhen the comparison is set up to select a number greater or less than another value, such as <<if score>"70">> <<score>> <<endif>>, 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 two IF statements: one that restricts text and one that returns the correct numeric value. For example:
<<if score<"A">> <<if score>"70">> <<score>> <<endif>> <<endif>>Requesting text less than A returns no text, and requesting scores greater than 70 returns only the scores with numeric values over 70. If the comparison information does not include quotation marks, the error message "Not a valid integer for comparison" will appear. For example, the statement
<<if score>70>> <<score>> <<endif>>should read
<<if score>"70">> <<score>> <<endif>>For more information on print merging and IF statements, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q141008 TITLE : WD: How to Force Text to Start at Same Line in Merged Letters ARTICLE-ID: Q122505 TITLE : WD: Selecting "(None)" Resets Filter Comparison ARTICLE-ID: Q113314 TITLE : WD: Word Err Msg: Word Could Not Parse Your Query Options ARTICLE-ID: Q97795 TITLE : WD: Using Print Merge to Create a List Sorted by Category ARTICLE-ID: Q66612 TITLE : WD: Second Expression in Conditional Print Merge Statement ARTICLE-ID: Q63687 TITLE : WD: Comparing Dates During Print Merge |
Additional query words: printmerge filemerge
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |