#1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
dleo dleo is offline
external usenet poster
 
Posts: 9
Default If statements

Is there a way to use IF statements within a mail merge? I'm using an excel
file as my data source. I have the prefix merge field, but about half of the
data entries have none. So when I merge in Word, the prefix field is skipped
(as it should), but I still get that space in between where the prefix would
go and the person's first name. Is there some sort of IF field where I could
basically say "if there IS a prefix put in the space, but if there isn't,
don't put a space."

I hope that makes sense.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default If statements

Use the follwing field construction

{ IF { MERGEFIELD Prefix } "" "{ MERGEFIELD Prefix } { MERGEFIELD
FirstName }" "{ MERGEFIELD FirstName } }

You may need to change the Prefix and FirstName to the actual names of your
fields.

You must use Ctrl+F9 to insert each pair of field delimiters { } and you use
Alt+F9 to toggle off their display.

--
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

"dleo" wrote in message
...
Is there a way to use IF statements within a mail merge? I'm using an
excel
file as my data source. I have the prefix merge field, but about half of
the
data entries have none. So when I merge in Word, the prefix field is
skipped
(as it should), but I still get that space in between where the prefix
would
go and the person's first name. Is there some sort of IF field where I
could
basically say "if there IS a prefix put in the space, but if there isn't,
don't put a space."

I hope that makes sense.



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
dleo dleo is offline
external usenet poster
 
Posts: 9
Default If statements


It didn't work. Well, the data merges successfully, but there is no space in
front of the first name no matter if there is a prefix or not. Also, my first
name field is 2 words (FIRST NAME) so maybe that has something to do with it.



"Doug Robbins - Word MVP" wrote:

Use the follwing field construction

{ IF { MERGEFIELD Prefix } "" "{ MERGEFIELD Prefix } { MERGEFIELD
FirstName }" "{ MERGEFIELD FirstName } }

You may need to change the Prefix and FirstName to the actual names of your
fields.

You must use Ctrl+F9 to insert each pair of field delimiters { } and you use
Alt+F9 to toggle off their display.

--
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

"dleo" wrote in message
...
Is there a way to use IF statements within a mail merge? I'm using an
excel
file as my data source. I have the prefix merge field, but about half of
the
data entries have none. So when I merge in Word, the prefix field is
skipped
(as it should), but I still get that space in between where the prefix
would
go and the person's first name. Is there some sort of IF field where I
could
basically say "if there IS a prefix put in the space, but if there isn't,
don't put a space."

I hope that makes sense.




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default If statements

I missed a closing quote when typing the construction

{ IF { MERGEFIELD Prefix } "" "{ MERGEFIELD Prefix } { MERGEFIELD
"First_Name" }" "{ MERGEFIELD "First_Name" }" }

If the name of the field that contains the first name is two words,. use the
construction as shown above.


--
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

"dleo" wrote in message
...

It didn't work. Well, the data merges successfully, but there is no space
in
front of the first name no matter if there is a prefix or not. Also, my
first
name field is 2 words (FIRST NAME) so maybe that has something to do with
it.



"Doug Robbins - Word MVP" wrote:

Use the follwing field construction

{ IF { MERGEFIELD Prefix } "" "{ MERGEFIELD Prefix } { MERGEFIELD
FirstName }" "{ MERGEFIELD FirstName } }

You may need to change the Prefix and FirstName to the actual names of
your
fields.

You must use Ctrl+F9 to insert each pair of field delimiters { } and you
use
Alt+F9 to toggle off their display.

--
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

"dleo" wrote in message
...
Is there a way to use IF statements within a mail merge? I'm using an
excel
file as my data source. I have the prefix merge field, but about half
of
the
data entries have none. So when I merge in Word, the prefix field is
skipped
(as it should), but I still get that space in between where the prefix
would
go and the person's first name. Is there some sort of IF field where I
could
basically say "if there IS a prefix put in the space, but if there
isn't,
don't put a space."

I hope that makes sense.






  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default If statements

Hi Doug,

I'd be inclined to use a simpler construction:
{IF{MERGEFIELD Prefix} "" "{MERGEFIELD Prefix} "}{MERGEFIELD "First_Name"}

For the OP, the steps to reproduce this would be:
.. copy your «Prefix» field and paste it into your document ahead of the «First_Name» field, thus -
«Prefix»«Prefix»«First_Name»;
.. select the two «Prefix» fields and press Ctrl-F9 to enclose them in a new field, thus -
{«Prefix»«Prefix»}«First_Name»;
.. fill in around the new field braces thus, paying careful attention to the spacing -
{IF«Prefix» "" "«Prefix» "}«First_Name»;
.. position the cursor anywhere in this field and press F9 to update it;
.. run the mailmerge.

--
Cheers
macropod
[MVP - Microsoft Word]


"Doug Robbins - Word MVP" wrote in message ...
I missed a closing quote when typing the construction

{ IF { MERGEFIELD Prefix } "" "{ MERGEFIELD Prefix } { MERGEFIELD
"First_Name" }" "{ MERGEFIELD "First_Name" }" }

If the name of the field that contains the first name is two words,. use the construction as shown above.


--
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

"dleo" wrote in message ...

It didn't work. Well, the data merges successfully, but there is no space in
front of the first name no matter if there is a prefix or not. Also, my first
name field is 2 words (FIRST NAME) so maybe that has something to do with it.



"Doug Robbins - Word MVP" wrote:

Use the follwing field construction

{ IF { MERGEFIELD Prefix } "" "{ MERGEFIELD Prefix } { MERGEFIELD
FirstName }" "{ MERGEFIELD FirstName } }

You may need to change the Prefix and FirstName to the actual names of your
fields.

You must use Ctrl+F9 to insert each pair of field delimiters { } and you use
Alt+F9 to toggle off their display.

--
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

"dleo" wrote in message
...
Is there a way to use IF statements within a mail merge? I'm using an
excel
file as my data source. I have the prefix merge field, but about half of
the
data entries have none. So when I merge in Word, the prefix field is
skipped
(as it should), but I still get that space in between where the prefix
would
go and the person's first name. Is there some sort of IF field where I
could
basically say "if there IS a prefix put in the space, but if there isn't,
don't put a space."

I hope that makes sense.








  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
dleo dleo is offline
external usenet poster
 
Posts: 9
Default If statements


Thank you macropod, your method is a lot easier. It works great!

Thanks again,
dleo

"macropod" wrote:

Hi Doug,

I'd be inclined to use a simpler construction:
{IF{MERGEFIELD Prefix} "" "{MERGEFIELD Prefix} "}{MERGEFIELD "First_Name"}

For the OP, the steps to reproduce this would be:
.. copy your «Prefix» field and paste it into your document ahead of the «First_Name» field, thus -
«Prefix»«Prefix»«First_Name»;
.. select the two «Prefix» fields and press Ctrl-F9 to enclose them in a new field, thus -
{«Prefix»«Prefix»}«First_Name»;
.. fill in around the new field braces thus, paying careful attention to the spacing -
{IF«Prefix» "" "«Prefix» "}«First_Name»;
.. position the cursor anywhere in this field and press F9 to update it;
.. run the mailmerge.

--
Cheers
macropod
[MVP - Microsoft Word]


"Doug Robbins - Word MVP" wrote in message ...
I missed a closing quote when typing the construction

{ IF { MERGEFIELD Prefix } "" "{ MERGEFIELD Prefix } { MERGEFIELD
"First_Name" }" "{ MERGEFIELD "First_Name" }" }

If the name of the field that contains the first name is two words,. use the construction as shown above.


--
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

"dleo" wrote in message ...

It didn't work. Well, the data merges successfully, but there is no space in
front of the first name no matter if there is a prefix or not. Also, my first
name field is 2 words (FIRST NAME) so maybe that has something to do with it.



"Doug Robbins - Word MVP" wrote:

Use the follwing field construction

{ IF { MERGEFIELD Prefix } "" "{ MERGEFIELD Prefix } { MERGEFIELD
FirstName }" "{ MERGEFIELD FirstName } }

You may need to change the Prefix and FirstName to the actual names of your
fields.

You must use Ctrl+F9 to insert each pair of field delimiters { } and you use
Alt+F9 to toggle off their display.

--
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

"dleo" wrote in message
...
Is there a way to use IF statements within a mail merge? I'm using an
excel
file as my data source. I have the prefix merge field, but about half of
the
data entries have none. So when I merge in Word, the prefix field is
skipped
(as it should), but I still get that space in between where the prefix
would
go and the person's first name. Is there some sort of IF field where I
could
basically say "if there IS a prefix put in the space, but if there isn't,
don't put a space."

I hope that makes sense.







Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
If then statements LSivak Mailmerge 1 November 9th 06 12:17 AM
IF statements not working jermsalerms79 Mailmerge 1 April 12th 06 03:34 PM
limits on if statements Robseym Mailmerge 4 March 7th 06 02:08 PM
IF Statements and REF Fields Anna Cooper Microsoft Word Help 1 October 15th 05 06:12 AM
financial statements Chris Microsoft Word Help 2 December 1st 04 03:08 AM


All times are GMT +1. The time now is 08:11 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"