![]() |
Leading the way in Microsoft Office Development |
| Home | | | Excel | | | Word | | | PowerPoint | | | Consultancy | | | Feedback | | | Contact |
| Microsoft Word > Fields > Document Automation > IF |
| IF Expression1 Operator Expression2 TrueText FalseText | |
| Compares two values and then inserts the text appropriate to the result of the comparison. |
| expression1 | Values you want to compare. | |
| expression2 | Values you want to compare. | |
| operator | Comparison operator: = Equal to <> Not equal to > Greater than < Less than >= Greater than or equal to <= Less than or equal to | |
| truetext | The text you want to appear when the comparison is True. | |
| falsetext | The text you want to appear when the comparison is False. |
| REMARKS |
| EXAMPLES | |
| { IF True "This is True" "This is False" } { IF {DocVariable "Team" }=False "Individual" "Group" \* MERGEFORMAT } { IF order>=100 "Thanks" "The minimum order is 100 units" } { IF { MERGEFIELD Rate } = { MERGEFIELD Discount } "We will offer you a larger discount. " " " } { IF { MERGEFIELD State } = "NY" "{ INCLUDETEXT c:\\worddocs\\contract.doc }" "{ AUTOTEXT Copyright }" } { IF { MERGEFIELD Company } <> " " "{ MERGEFIELD CompanyAddress }" "{ MERGEFIELD HomeAddress }" } { IF { = { MERGEFIELD Balance } - {MERGEFIELD Payment } } > 0 "Your current balance is { = { MERGEFIELD Balance } - { MERGEFIELD Payment } \# "$#,##0.00;($#,##0.00) " }." "Your account is paid in full. Thank you." } { IF { = AND ( { COMPARE { MERGEFIELD CustomerNumber } >= 4 }, { COMPARE { MERGEFIELD CustomerRating } <= 3 } ) } = 1 "Satisfactory" "Unsatisfactory"} {IF {MERGEFIELD State} = "CA" "For California residents, we offer special rates to Asia and Japan." "{IF {MERGEFIELD State} = "WA" "For Washington residents, we offer special rates to Asia and Japan." " "} "} { IF CurrentRate < LoanRate "You may want to consider refinancing your loan." " " } |
| Fields - I | Index - I | Office Online |
| Copyright © 2004-2007 Better Solutions Limited. All Rights Reserved. | Top |