Format switches for text comparisons by IF fields

Microsoft Office Word 2003

Show All Show All

Format switches for text comparisons by IF fields

When an IF field compares a data field with the information you specify in the Field dialog box (Insert menu, Field command), the capitalization of text is significant. If you don't know whether text in a data field is in uppercase or lowercase letters, use a format switch to compare the text as though it had the same capitalization pattern you type for Expression2.

In the following example, the (\* Caps) switch instructs Microsoft Word to compare the Country data field as though each word starts with a capital letter. Insert the format switch in the IF field codes, as shown in the example.

{ IF {MERGEFIELD Country \* Caps } <> "United Kingdom" "We offer special rates on travel to the British Isles." " " }

Use the following switches for comparisons:

\*Upper
Compare all uppercase letters (UNITED KINGDOM).
\*Lower
Compare all lowercase letters (united kingdom).
\*FirstCap
Compare first word with an initial capital letter (United kingdom).
\*Caps
Compare all words with an initial capital letter (United Kingdom).