A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

IF Statements in Mail Merge



 
 
Thread Tools Display Modes
  #1  
Old February 16th, 2010, 04:05 PM posted to microsoft.public.word.mailmerge.fields
Lurkette
external usenet poster
 
Posts: 9
Default IF Statements in Mail Merge

I am having difficulties with creating an If statement within a Mail Merge
document. I have looked at a number of threads to find out how to construct
the statement and a number of articles on the web but still I cannot generate
the correct response. I am trying to extract information from Excel. If the
Excel cell = "NoInfo" then the Word field should be " " otherwise merge the
field from Excel into Word. I seem to be having problems with the spacing in
my statements, but whenever I have followed the examples my statement does
not work. I have tried both inserting a field and typing the statement &
then Ctrl F9, but still no success. I have tried numerous combinations of
spacing according to the examples but to no avail.
Can anyone help?
IF {MERGEFIELDBOAT_NAME1} = "NoInfo" " "{ MERGEFIELD BOAT_NAME1 }"

  #2  
Old February 16th, 2010, 07:35 PM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default IF Statements in Mail Merge

The field construction that you need is

{ IF {MERGEFIELDBOAT_NAME1} = "NoInfo" "" "{ MERGEFIELD BOAT_NAME1 }" }

However, the quote marks around the second {MERGEFIELDBOAT_NAME1} are not
essential and you could just use

{ IF {MERGEFIELDBOAT_NAME1} = "NoInfo" "" { MERGEFIELD BOAT_NAME1 } }

However ALL of the field delimiters { } must be inserted by using Ctrl+F9

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Lurkette" wrote in message
...
I am having difficulties with creating an If statement within a Mail Merge
document. I have looked at a number of threads to find out how to
construct
the statement and a number of articles on the web but still I cannot
generate
the correct response. I am trying to extract information from Excel. If
the
Excel cell = "NoInfo" then the Word field should be " " otherwise merge
the
field from Excel into Word. I seem to be having problems with the spacing
in
my statements, but whenever I have followed the examples my statement does
not work. I have tried both inserting a field and typing the statement &
then Ctrl F9, but still no success. I have tried numerous combinations of
spacing according to the examples but to no avail.
Can anyone help?
IF {MERGEFIELDBOAT_NAME1} = "NoInfo" " "{ MERGEFIELD BOAT_NAME1 }"

  #3  
Old February 16th, 2010, 08:38 PM posted to microsoft.public.word.mailmerge.fields
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default IF Statements in Mail Merge

Hi Lurkette,

Try this approach:
.. duplicate the mailmerge field to be tested (ie «Boat_Name1») so that you get «Boat_Name1»«Boat_Name1»;
.. select both fields and Press Ctrl-F9 to enclose them in a new field, thus {«Boat_Name1»«Boat_Name1»};
.. fill in around the new field braces so that you end up with: {IF«Boat_Name1» "" «Boat_Name1»};
.. position the cursor anywhere in this field and press F9 to update it;
.. run your mailmerge.

--
Cheers
macropod
[Microsoft MVP - Word]


"Lurkette" wrote in message ...
I am having difficulties with creating an If statement within a Mail Merge
document. I have looked at a number of threads to find out how to construct
the statement and a number of articles on the web but still I cannot generate
the correct response. I am trying to extract information from Excel. If the
Excel cell = "NoInfo" then the Word field should be " " otherwise merge the
field from Excel into Word. I seem to be having problems with the spacing in
my statements, but whenever I have followed the examples my statement does
not work. I have tried both inserting a field and typing the statement &
then Ctrl F9, but still no success. I have tried numerous combinations of
spacing according to the examples but to no avail.
Can anyone help?
IF {MERGEFIELDBOAT_NAME1} = "NoInfo" " "{ MERGEFIELD BOAT_NAME1 }"


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:25 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.