Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / November 2006

Tip: Looking for answers? Try searching our database.

Mergefield with comma, suppress comma if field blank

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JB reluctantly from WP - 16 Nov 2006 22:42 GMT
Hello,

I have an Excel database file, and am merging into a Word document.  I am
familiar with Word's merge process.

I need to display mergefields "LAST_NAME, FIRST_NAME" but only want the
comma if FIRST_NAME field is not blank.  When FIRST_NAME field is blank, I
only want to diplay the LAST_NAME field.  I'm having a heckuva time trying to
get the right IF statement to produce the wanted results.

My attempt at the IF statement:   {IF {MERGEFIELD "FIRST_NAME"} <> "" "
{MERGEFIELD "LAST_NAME"},"} {MERGEFIELD "FIRST_NAME"}

I have a feeling I'm really close!  However, the results produced by this
statement resulted in the last name not printing at all if the first name was
blank.

Any assistance is greatly appreciated!

~Julie
Peter Jamieson - 16 Nov 2006 22:48 GMT
{IF {MERGEFIELD "FIRST_NAME"} <> "" "
{MERGEFIELD "LAST_NAME"},"} {MERGEFIELD "FIRST_NAME"}

{ MERGEFIELD LAST_NAME }{ IF "{ MERGEFIELD FIRST_NAME }" = ""
"" ", { MERGEFIELD FIRST_NAME }" }

If you're only using Word 2002 or 2003 you can probably use

{ MERGEFIELD LAST_NAME }{ MERGEFIELD FIRST_NAME \b ", " }

Peter Jamieson

> Hello,
>
[quoted text clipped - 18 lines]
>
> ~Julie
JB reluctantly from WP - 17 Nov 2006 00:36 GMT
Thanks Peter, since I'm "only" using Word 2002 your last suggestion
(...\b...) did the trick!

Thanks to both Peter and Macropod for your quick responses!

~Julie

> {IF {MERGEFIELD "FIRST_NAME"} <> "" "
> {MERGEFIELD "LAST_NAME"},"} {MERGEFIELD "FIRST_NAME"}
[quoted text clipped - 30 lines]
> >
> > ~Julie
macropod - 16 Nov 2006 22:55 GMT
Hi Julie,

Try:
{IF{MERGEFIELD FIRST_NAME}= "" "{MERGEFIELD FIRST_NAME}, "}{MERGEFIELD
LAST_NAME}
to put 'FIRST_NAME' before 'LAST_NAME', or
{MERGEFIELD LAST_NAME}{IF{MERGEFIELD FIRST_NAME}= "" "" ", {MERGEFIELD
FIRST_NAME}"}
to put 'LAST_NAME' before 'FIRST_NAME',
Note how 'LAST_NAME' is outside the IF test in both cases.

Cheers
Signature

macropod
[MVP - Microsoft Word]

> Hello,
>
[quoted text clipped - 16 lines]
>
> ~Julie
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.