How to you say IF [field] contains "x" then "" else ""

  • Thread starter Thread starter rwav1
  • Start date Start date
R

rwav1

In a Word merge, how to you have Word look at a text file and proceed with
THEN/ELSE only if the field "CONTAINS" or "IF BEGINS WITH" a key word in the
expression. Since the field is not a number the greater/less and even
"blank" do not apply. Thanks.
 
Hi rwav1,

For a field starting with a given string:
{IF{MERGEFIELD MyField} = "MyTestString*" "True Text" "False Text"}
For a field ending with a given string:
{IF{MERGEFIELD MyField} = "*MyTestString" "True Text" "False Text"}

For a field starting with 3 characters before a given string:
{IF{MERGEFIELD MyField} = "???MyTestString*" "True Text" "False Text"}
For a field ending with 3 characters after a given string:
{IF{MERGEFIELD MyField} = "*MyTestString???" "True Text" "False Text"}

There is no general 'contains' test - the test string must exist at the start or end of the larger string or a specified number of
characters from either end of the larger string.
 
Back
Top