Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Michelle
 
Posts: n/a
Default If then else question

Can somebody help me with the correct syntax for the following:

If NAME2 is blank
Then NAME1description + ",and"
Else NAME1description
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default If then else question

{ IF { MERGEFIELD NAME2 } = "" "{ MERGEFIELD NAME1description }, and " "{
MERGEFIELD NAME1descript }" }

You must use Ctrl+F9 to insert each pair of field delimiters { } and Alt+F9
to toggle 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

"Michelle" wrote in message
...
Can somebody help me with the correct syntax for the following:

If NAME2 is blank
Then NAME1description + ",and"
Else NAME1descript



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Michelle
 
Posts: n/a
Default If then else question

Thanks for your prompt reply, but unfortunately, I now understand this is not
the result I want, after all. I have 5 mergefields for names ("John Smith",
etc) and 5 merge fields for descriptions ("an individual") but don't know in
advance how many the record will actually contain.

This is what I got using your suggestions:
JOHN SMITH, an individual
MARY SMITH, an individual
an individual, and
an individual, and
an individual, and
an individual, and

Here's the result I really need:
JOHN SMITH, an individual
MARY SMITH, an individual, and

So, I always need ", and" after the last name.

Is there a way to do this? Sorry about my confused mind!



"Doug Robbins - Word MVP" wrote:

{ IF { MERGEFIELD NAME2 } = "" "{ MERGEFIELD NAME1description }, and " "{
MERGEFIELD NAME1descript }" }

You must use Ctrl+F9 to insert each pair of field delimiters { } and Alt+F9
to toggle 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

"Michelle" wrote in message
...
Can somebody help me with the correct syntax for the following:

If NAME2 is blank
Then NAME1description + ",and"
Else NAME1descript

  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default If then else question

If you always need ", and" after the last name, do not make it part of the
mergefield construction. Simply have it as text in the document.

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

"Michelle" wrote in message
...
Thanks for your prompt reply, but unfortunately, I now understand this is
not
the result I want, after all. I have 5 mergefields for names ("John
Smith",
etc) and 5 merge fields for descriptions ("an individual") but don't know
in
advance how many the record will actually contain.

This is what I got using your suggestions:
JOHN SMITH, an individual
MARY SMITH, an individual
an individual, and
an individual, and
an individual, and
an individual, and

Here's the result I really need:
JOHN SMITH, an individual
MARY SMITH, an individual, and

So, I always need ", and" after the last name.

Is there a way to do this? Sorry about my confused mind!



"Doug Robbins - Word MVP" wrote:

{ IF { MERGEFIELD NAME2 } = "" "{ MERGEFIELD NAME1description }, and " "{
MERGEFIELD NAME1descript }" }

You must use Ctrl+F9 to insert each pair of field delimiters { } and
Alt+F9
to toggle 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

"Michelle" wrote in message
...
Can somebody help me with the correct syntax for the following:

If NAME2 is blank
Then NAME1description + ",and"
Else NAME1descript



  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Michelle
 
Posts: n/a
Default If then else question

That was the first thing I tried - the result was spaces before the comma
like this:

JOHN SMITH, an individual; MARY SMITH, an individual ,and


"Doug Robbins - Word MVP" wrote:

If you always need ", and" after the last name, do not make it part of the
mergefield construction. Simply have it as text in the document.

--
Hope this helps.




  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default If then else question

You must have some uneeded spaces in the field construction some where.

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

"Michelle" wrote in message
...
That was the first thing I tried - the result was spaces before the comma
like this:

JOHN SMITH, an individual; MARY SMITH, an individual ,and


"Doug Robbins - Word MVP" wrote:

If you always need ", and" after the last name, do not make it part of
the
mergefield construction. Simply have it as text in the document.

--
Hope this helps.




  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Michelle
 
Posts: n/a
Default If then else question

No, unfortunately, they are not uneeded:

Here's what I have as merge codes (and I will add ", and" per your
suggestion):

Name1, Name1description Name2, Name2 description Name3 Name3,
description Name4, Name4 description Name 5, Name 5 description, and

This works fine if indeed 5 names are merged. But if any less than 5 are
merged, there are spaces before ", and".

So if there is only one name in the record, the result is:
JOHN SMITH, an individual , and

That's why the ", and" needs to be in the mergecode.

Hope this is clear and that you have a solution.

"Doug Robbins - Word MVP" wrote:

You must have some uneeded spaces in the field construction some where.

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

  #8   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default If then else question

You still need the If...then...Else... fields to check for data in Name2,
Name3, Name4 and Name5. If there is not data insert nothing, if there is
data, insert that data preceeded by whatever it is that you want to separate
it from the previous item.

The construction will be

{ MERGEFIELD Name1 }, { MERGEFIELD Name1Description }{ IF { MERGEFIELD
Name2 } = "" "" "; { MERGEFIELD Name2 }, { MERGEFIELD
Name2Description }" }{IF { MERGEFIELD Name3 } = "" "" "; { MERGEFIELD
Name3 }, { MERGEFIELD Name3Description }" }{IF { MERGEFIELD Name4 } = "" ""
"; { MERGEFIELD Name4 }, { MERGEFIELD Name4Description }" }(IF { MERGEFIELD
Name5 } = "" "" "; { MERGEFIELD Name5 }, { MERGEFIELD Name5Description }" },
and

Note that there is no space between the } and the { IF

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

"Michelle" wrote in message
...
No, unfortunately, they are not uneeded:

Here's what I have as merge codes (and I will add ", and" per your
suggestion):

Name1, Name1description Name2, Name2 description Name3 Name3,
description Name4, Name4 description Name 5, Name 5 description, and

This works fine if indeed 5 names are merged. But if any less than 5 are
merged, there are spaces before ", and".

So if there is only one name in the record, the result is:
JOHN SMITH, an individual , and

That's why the ", and" needs to be in the mergecode.

Hope this is clear and that you have a solution.

"Doug Robbins - Word MVP" wrote:

You must have some uneeded spaces in the field construction some where.

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



  #9   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Michelle
 
Posts: n/a
Default If then else question

Thanks SO much - that was great. There is only one teeny thing left -
somehow I am getting 2 spaces between each record, and I'd really like only
one. I tried playing around with the quotes, but obviously don't understand
how to do it. Can you show me please?

"Doug Robbins - Word MVP" wrote:

You still need the If...then...Else... fields to check for data in Name2,
Name3, Name4 and Name5. If there is not data insert nothing, if there is
data, insert that data preceeded by whatever it is that you want to separate
it from the previous item.

The construction will be

{ MERGEFIELD Name1 }, { MERGEFIELD Name1Description }{ IF { MERGEFIELD
Name2 } = "" "" "; { MERGEFIELD Name2 }, { MERGEFIELD
Name2Description }" }{IF { MERGEFIELD Name3 } = "" "" "; { MERGEFIELD
Name3 }, { MERGEFIELD Name3Description }" }{IF { MERGEFIELD Name4 } = "" ""
"; { MERGEFIELD Name4 }, { MERGEFIELD Name4Description }" }(IF { MERGEFIELD
Name5 } = "" "" "; { MERGEFIELD Name5 }, { MERGEFIELD Name5Description }" },
and

Note that there is no space between the } and the { IF

--
Hope this helps.

  #10   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default If then else question

Is that two spaces between the semicolon and the first letter of the
following name? Or, do you mean each record in the data source?

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

"Michelle" wrote in message
...
Thanks SO much - that was great. There is only one teeny thing left -
somehow I am getting 2 spaces between each record, and I'd really like
only
one. I tried playing around with the quotes, but obviously don't
understand
how to do it. Can you show me please?

"Doug Robbins - Word MVP" wrote:

You still need the If...then...Else... fields to check for data in Name2,
Name3, Name4 and Name5. If there is not data insert nothing, if there is
data, insert that data preceeded by whatever it is that you want to
separate
it from the previous item.

The construction will be

{ MERGEFIELD Name1 }, { MERGEFIELD Name1Description }{ IF { MERGEFIELD
Name2 } = "" "" "; { MERGEFIELD Name2 }, { MERGEFIELD
Name2Description }" }{IF { MERGEFIELD Name3 } = "" "" "; { MERGEFIELD
Name3 }, { MERGEFIELD Name3Description }" }{IF { MERGEFIELD Name4 } = ""
""
"; { MERGEFIELD Name4 }, { MERGEFIELD Name4Description }" }(IF {
MERGEFIELD
Name5 } = "" "" "; { MERGEFIELD Name5 }, { MERGEFIELD
Name5Description }" },
and

Note that there is no space between the } and the { IF

--
Hope this helps.





  #11   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Michelle
 
Posts: n/a
Default If then else question

It's between the semicolon and the first letter of the following name

"Doug Robbins - Word MVP" wrote:

Is that two spaces between the semicolon and the first letter of the
following name? Or, do you mean each record in the data source?

--

  #12   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default If then else question

Maybe there is a space before the name in the data source. But you can
always remove the space after the semi-colon in the field construction:

{ MERGEFIELD Name1 }, { MERGEFIELD Name1Description }{ IF { MERGEFIELD
Name2 } = "" "" ";{ MERGEFIELD Name2 }, { MERGEFIELD
Name2Description }" }{IF { MERGEFIELD Name3 } = "" "" ";{ MERGEFIELD
Name3 }, { MERGEFIELD Name3Description }" }{IF { MERGEFIELD Name4 } = "" ""
";{ MERGEFIELD Name4 }, { MERGEFIELD Name4Description }" }(IF { MERGEFIELD
Name5 } = "" "" ";{ MERGEFIELD Name5 }, { MERGEFIELD Name5Description }" },
and


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

"Michelle" wrote in message
...
It's between the semicolon and the first letter of the following name

"Doug Robbins - Word MVP" wrote:

Is that two spaces between the semicolon and the first letter of the
following name? Or, do you mean each record in the data source?

--



  #13   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Michelle
 
Posts: n/a
Default If then else question

Sorry, I didn't use the semi-colon because it is built into the description.
I keep playing with those quotes but either I get two spaces or none. Still
hoping you have a solution. Thanks.

"Doug Robbins - Word MVP" wrote:

Maybe there is a space before the name in the data source. But you can
always remove the space after the semi-colon in the field construction:

{ MERGEFIELD Name1 }, { MERGEFIELD Name1Description }{ IF { MERGEFIELD
Name2 } = "" "" ";{ MERGEFIELD Name2 }, { MERGEFIELD
Name2Description }" }{IF { MERGEFIELD Name3 } = "" "" ";{ MERGEFIELD
Name3 }, { MERGEFIELD Name3Description }" }{IF { MERGEFIELD Name4 } = "" ""
";{ MERGEFIELD Name4 }, { MERGEFIELD Name4Description }" }(IF { MERGEFIELD
Name5 } = "" "" ";{ MERGEFIELD Name5 }, { MERGEFIELD Name5Description }" },
and

  #14   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Michelle
 
Posts: n/a
Default If then else question

Ok, now I figured it out and removed the space where the semi-colon WOULD
have been had I used it! I was off on the wrong track with the quotes.

That wraps it up. Thank you again very much for your patience and knowledge.
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
Be nice if your suggested answers fit the question. Harvey Eastman Microsoft Word Help 3 April 20th 06 02:59 PM
Exam question wrong about Word? Opinions, please! Jamie Furlong New Users 6 April 18th 06 11:56 AM
"Save document" question! billybob New Users 2 March 20th 06 06:32 AM
AutoRecovery Question Thomas M Microsoft Word Help 6 July 26th 05 02:50 AM
Newbie document question please Dudley Henriques New Users 4 January 9th 05 08:38 PM


All times are GMT +1. The time now is 06:59 PM.

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"