How To Mail Merge a Document With Both A Numbered List and If/Then Conditionals, When Some Lines May Be Empty

0

I am mail-merging a letter and ran into a problem with how numbered lists and if/then/else conditionals interact. Can any Microsoft Word experts help me out? :-)

Imagine a numbered list like so:

1. You are awesome 2. You are not awesome 3. This is something else

Now, imagine that the items that appear next to #1-2 are mutually exclusive. Thus, there are two desired possible results after a mail merge:

DESIRED OUTPUT FOR AWESOME CASE

1. You are awesome 2. This is something else

OR

DESIRED OUTPUT FOR NOT AWESOME CASE

1. You are not awesome 2. This is something else

The actual output is like so:

ACTUAL OUTPUT FOR AWESOME CASE

1. You are awesome 2. 3. This is something else

ACTUAL OUTPUT FOR UNAWESOME CASE

1. 2. You are not awesome 3. This is something else

Here is the code that I'm using:

{ IF {MERGEFIELD IS_AWESOME} = "x" "You are awesome"} } { IF {MERGEFIELD IS_NOT_AWESOME} = "x" "You are not awesome"} }

These lines have a "numbered list" format applied to it. (I know of no way of making a line item appear as a numbered list without using the standard "numbered list" button.)

I can conceive of a workaround in which I use nested if statements to suppress empty lines, by merging all the conditions of numbered items 1-3. But my actual example has 12 lines, and the number of if-then statements would be exponentially large.

Is there a direct way of making Microsoft Word generate my desired output?

Thanks!

bobbyh

Posted 2016-05-16T17:48:09.070

Reputation: 103

Answers

1

I think if you include the respective returns in your formula, it would work:

{ IF {MERGEFIELD IS_NOT_AWESOME} = "x" "You are not awesome<RET>"} }

because when the formula removes the text (IF is not true), the return is also removed, so you don't get a blank line with a number.

you will have to remove your now 'additional' returns, and the IFs will be in one continuous stream, which is optically a bit a nuisance - but it should work; I have used that before:

{ IF {MERGEFIELD IS_AWESOME} = "x" "You are awesome<RET>"} }{ IF {MERGEFIELD IS_NOT_AWESOME} = "x" "You are not awesome<RET>"} }

Aganju

Posted 2016-05-16T17:48:09.070

Reputation: 9 103

Thanks, this is great. Your insight of putting all the IF MERGEFIELDs on one line is genius. :-)

Note for others: if your bullets/numbered-items has multiple lines (requiring a carriage-return of sorts), you can use a shift-enter to prevent Word from adding bullets/numbers to the subsequent lines. – bobbyh – 2016-05-18T04:10:03.067