Solved

MS Word Mail Merge with If Then

Posted on 2011-02-23
8
366 Views
Last Modified: 2012-05-11
I can't figure out where my syntax is wrong.....

IF "{MERGEFIELD  CFO_name}" = ''"  "{MERGEFIELD managing_partner}" "{MERGEFIELD CFO_name}"

My result is: CFO_name}

If I use this:
IF "{ MERGEFIELD "CFO_name"}" = ''"  "{ MERGEFIELD "managing_partner"}" "{ MERGEFIELD "CFO_name"}"

my result is: CFO_name


Any help?
0
Comment
Question by:jasgot
  • 3
  • 3
  • 2
8 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 34964643
In the expanded field dispaly that we use, the {} pairs should actually be field delimiters and will appear slightly different on the actual document.

If you get an extra curly bracket after the data from the field CFO_Name in the result document, then it is likely to be that character, and not a field delimiter, because there is no delimiter that maps the start of the field (or at least you haven't shown it).

With that in mind, I suggest that you check the fields again. If you still have a problem, try reducing the document to the failing section and posting it here, so that we can have a look at it.

0
 

Author Comment

by:jasgot
ID: 34964800
The If statement above is what's inside the <ctrl>-<f9> brackets.  I'm not getting the field data followed by the curly, I'm getting "CFO_name}" in the resulting merge.

0
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 34964837
Hello,

You are using to many quote marks. It should look like this

{IF { MERGEFIELD "CFO_name"} = ''"  "{ MERGEFIELD "managing_partner"}" "{ MERGEFIELD "CFO_name"}" }

No "" quote marks required in the condition (other than for the field name). The syntax is

{ IF condition "do when true" "do when false"}

cheers, teylyn
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:jasgot
ID: 34965057
teylyn;

if I press ctrl-F9 to get the sqiggly braces, then paste in your code without the beginning and ending braces, I get "MERGEFIELD" returned in my document.


0
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst earned 500 total points
ID: 34965184
Hello,

you can't just paste what I've posted. You need to enter each field with the Ctrl-F9 key. And I'm not too sure the "" are required for the mergefield names.

Step by step:

Hit Ctrl-F9
type IF between the brackets and add a space

should look like: {IF }

after the space hit Ctrl-F9 again

should look like: {IF {}}

Between these new brackets, enter
MERGEFIELD CFO_name

Should look like: {IF {MERGEFIELD CFO_name}}

click between the two closing brackets and enter
= ""

Should look like: {IF {MERGEFIELD CFO_name} = ""}

add a space and then two double quotes ""

Should look like: {IF {MERGEFIELD CFO_name} = "" ""}

put the cursor between the double quotes and hit Ctrl-F9

Should look like: {IF {MERGEFIELD CFO_name} = "" "{}"}

between the new pair of {} enter

MERGEFIELD managing_partner

Should look like: {IF {MERGEFIELD CFO_name} = "" "{MERGEFIELD managing_partner}"}

before the last closing bracket enter a space and two quotes ""

Should look like: {IF {MERGEFIELD CFO_name} = "" "{MERGEFIELD managing_partner}" ""}

click between the last two quotes and hit Ctrl-F9

Should look like: {IF {MERGEFIELD CFO_name} = "" "{MERGEFIELD managing_partner}" "{}"}

between the last pair of brackets enter

MERGEFIELD CFO_name

Should look like: {IF {MERGEFIELD CFO_name} = "" "{MERGEFIELD managing_partner}" "{MERGEFIELD CFO_name}"}

That's it.



0
 

Author Closing Comment

by:jasgot
ID: 34965279
Thanks! I appreciate your step by step! :)  My error was that I thought ON:Y the outsie curlies needed to be created by Ctrl-F9, I was using regular curlies for the iside fields :(

Thanks!
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 34965955
teylyn,

I gather that you are OK. Are you on the South Island?
0
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 34966182
G, all fine, thx. I'm in Taranaki, north island
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question