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  

Using IF to add a character



 
 
Thread Tools Display Modes
  #1  
Old August 14th, 2007, 11:42 PM posted to microsoft.public.word.mailmerge.fields
Asinger
external usenet poster
 
Posts: 12
Default Using IF to add a character

I'm not sure if an IF rule is the right way to do this. I am creating a
Directory Merge, a list of names/addresses/phones/email. Some people have
more than one phone (e.g., home and cell). I would like the phones to be on
the same line, formatted as follows:

505-555-5555 / 505-555-6666

I right clicked the merge field for the second phone number shown above and
chose Edit Field. I selected the "Text to be inserted after:" check box and
entered space / space (where "space" is an actual space, not the word space).
This works great as long as there is always a value in the first phone number
field (I thought there would be but I have some records where there is only a
cell, the second phone number field, and no home phone, the first phone
number field). So instead of looking like the above example, I get this in
that case:

/ 505-555-6666

I think I need to add the spaces and slash after the first phone number
field, but I only want those characters to be used when the second phone
number field is not blank. Is that right? If so, can someone help me with
formatting the IF rule?

PART 2: What is the difference with inserting rules using the Rules
drop-down in the Ribbon versus right clicking a merge field and choosing Edit
Field? When should I use one over the other - or does it matter?

Thanks!
  #2  
Old August 15th, 2007, 12:13 AM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Using IF to add a character

Use the following field construction:

{ IF { MERGEFIELD Home } "" "{ IF { MERGEFIELD Cell } "" "{ MERGEFIELD
Home } / { MERGEFIELD Cell }" "{ MERGEFIELD Home }" }" "{ MERGEFIELD
Cell }" }

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

"Asinger" wrote in message
...
I'm not sure if an IF rule is the right way to do this. I am creating a
Directory Merge, a list of names/addresses/phones/email. Some people have
more than one phone (e.g., home and cell). I would like the phones to be
on
the same line, formatted as follows:

505-555-5555 / 505-555-6666

I right clicked the merge field for the second phone number shown above
and
chose Edit Field. I selected the "Text to be inserted after:" check box
and
entered space / space (where "space" is an actual space, not the word
space).
This works great as long as there is always a value in the first phone
number
field (I thought there would be but I have some records where there is
only a
cell, the second phone number field, and no home phone, the first phone
number field). So instead of looking like the above example, I get this in
that case:

/ 505-555-6666

I think I need to add the spaces and slash after the first phone number
field, but I only want those characters to be used when the second phone
number field is not blank. Is that right? If so, can someone help me with
formatting the IF rule?

PART 2: What is the difference with inserting rules using the Rules
drop-down in the Ribbon versus right clicking a merge field and choosing
Edit
Field? When should I use one over the other - or does it matter?

Thanks!



  #3  
Old August 15th, 2007, 12:58 AM posted to microsoft.public.word.mailmerge.fields
Asinger
external usenet poster
 
Posts: 12
Default Using IF to add a character

Doug - I understand about using Ctrl-F9 to produce the brackets. When I do
that, Word auto-inserts two spaces so that if I begin typing, my entry is
preceded and ended with a space (after/before open/close brackets). Your
entry seems to have the spaces too - can you just confirm for me that the
spaces are necessary? Also, do I type this directly in my merge document, and
where should I type it with respect to the merge fields? Thanks very much.
April

"Doug Robbins - Word MVP" wrote:

Use the following field construction:

{ IF { MERGEFIELD Home } "" "{ IF { MERGEFIELD Cell } "" "{ MERGEFIELD
Home } / { MERGEFIELD Cell }" "{ MERGEFIELD Home }" }" "{ MERGEFIELD
Cell }" }

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

"Asinger" wrote in message
...
I'm not sure if an IF rule is the right way to do this. I am creating a
Directory Merge, a list of names/addresses/phones/email. Some people have
more than one phone (e.g., home and cell). I would like the phones to be
on
the same line, formatted as follows:

505-555-5555 / 505-555-6666

I right clicked the merge field for the second phone number shown above
and
chose Edit Field. I selected the "Text to be inserted after:" check box
and
entered space / space (where "space" is an actual space, not the word
space).
This works great as long as there is always a value in the first phone
number
field (I thought there would be but I have some records where there is
only a
cell, the second phone number field, and no home phone, the first phone
number field). So instead of looking like the above example, I get this in
that case:

/ 505-555-6666

I think I need to add the spaces and slash after the first phone number
field, but I only want those characters to be used when the second phone
number field is not blank. Is that right? If so, can someone help me with
formatting the IF rule?

PART 2: What is the difference with inserting rules using the Rules
drop-down in the Ribbon versus right clicking a merge field and choosing
Edit
Field? When should I use one over the other - or does it matter?

Thanks!




  #4  
Old August 15th, 2007, 06:45 AM posted to microsoft.public.word.mailmerge.fields
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Using IF to add a character

The spaces are not *required*, but as Word's insert field adds them, they
are best inserted for standardisation (e.g. you may wish to use replace on a
document so it helps if all are inserted the same way).
i.e.
{ MERGEFIELD Home }
and
{MERGEFIELD Home}
will both work equally well.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Asinger wrote:
Doug - I understand about using Ctrl-F9 to produce the brackets. When
I do that, Word auto-inserts two spaces so that if I begin typing, my
entry is preceded and ended with a space (after/before open/close
brackets). Your entry seems to have the spaces too - can you just
confirm for me that the spaces are necessary? Also, do I type this
directly in my merge document, and where should I type it with
respect to the merge fields? Thanks very much. April

"Doug Robbins - Word MVP" wrote:

Use the following field construction:

{ IF { MERGEFIELD Home } "" "{ IF { MERGEFIELD Cell } "" "{
MERGEFIELD Home } / { MERGEFIELD Cell }" "{ MERGEFIELD Home }" }" "{
MERGEFIELD
Cell }" }

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

"Asinger" wrote in message
...
I'm not sure if an IF rule is the right way to do this. I am
creating a Directory Merge, a list of names/addresses/phones/email.
Some people have more than one phone (e.g., home and cell). I would
like the phones to be on
the same line, formatted as follows:

505-555-5555 / 505-555-6666

I right clicked the merge field for the second phone number shown
above and
chose Edit Field. I selected the "Text to be inserted after:" check
box and
entered space / space (where "space" is an actual space, not the
word space).
This works great as long as there is always a value in the first
phone number
field (I thought there would be but I have some records where there
is only a
cell, the second phone number field, and no home phone, the first
phone number field). So instead of looking like the above example,
I get this in that case:

/ 505-555-6666

I think I need to add the spaces and slash after the first phone
number field, but I only want those characters to be used when the
second phone number field is not blank. Is that right? If so, can
someone help me with formatting the IF rule?

PART 2: What is the difference with inserting rules using the Rules
drop-down in the Ribbon versus right clicking a merge field and
choosing Edit
Field? When should I use one over the other - or does it matter?

Thanks!



  #5  
Old August 15th, 2007, 09:32 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Using IF to add a character

Just to add a couple of obscure details to Graham's comment
a. in the very early versions of Windows Word, Word did /not/ insert those
extra spaces automatically. I think those extra spaces arrived in Word 6.
a. there are at least two places where having a space before the closing
brace makes a difference:

{ MACROBUTTON mymacro mytext }blah
displays
mytext blah

whereas

{ MACROBUTTON mymacro mytext}blah
displays
mytextblah

and similarly

{ EQ \l(1,2,3) }blah
displays
1,2,3 blah

whereas
{ EQ \l(1,2,3)}blah
displays
1,2,3blah

There could be others, but for example SET and QUOTE fields do not behave
this way.

Peter Jamieson

"Asinger" wrote in message
...
Doug - I understand about using Ctrl-F9 to produce the brackets. When I do
that, Word auto-inserts two spaces so that if I begin typing, my entry is
preceded and ended with a space (after/before open/close brackets). Your
entry seems to have the spaces too - can you just confirm for me that the
spaces are necessary? Also, do I type this directly in my merge document,
and
where should I type it with respect to the merge fields? Thanks very much.
April

"Doug Robbins - Word MVP" wrote:

Use the following field construction:

{ IF { MERGEFIELD Home } "" "{ IF { MERGEFIELD Cell } "" "{
MERGEFIELD
Home } / { MERGEFIELD Cell }" "{ MERGEFIELD Home }" }" "{ MERGEFIELD
Cell }" }

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

"Asinger" wrote in message
...
I'm not sure if an IF rule is the right way to do this. I am creating a
Directory Merge, a list of names/addresses/phones/email. Some people
have
more than one phone (e.g., home and cell). I would like the phones to
be
on
the same line, formatted as follows:

505-555-5555 / 505-555-6666

I right clicked the merge field for the second phone number shown above
and
chose Edit Field. I selected the "Text to be inserted after:" check box
and
entered space / space (where "space" is an actual space, not the word
space).
This works great as long as there is always a value in the first phone
number
field (I thought there would be but I have some records where there is
only a
cell, the second phone number field, and no home phone, the first phone
number field). So instead of looking like the above example, I get this
in
that case:

/ 505-555-6666

I think I need to add the spaces and slash after the first phone number
field, but I only want those characters to be used when the second
phone
number field is not blank. Is that right? If so, can someone help me
with
formatting the IF rule?

PART 2: What is the difference with inserting rules using the Rules
drop-down in the Ribbon versus right clicking a merge field and
choosing
Edit
Field? When should I use one over the other - or does it matter?

Thanks!





 




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 07:31 AM.


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