IF statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to apply an IF statement to a mailmerge field in a document. The
field in question is a 'Name' and is stored in the database as, for example,
'Paul_Jacques'. What I want to do is strip out the underscore and replace it
with a SPACE. I've tried the following:

IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF
"Anthony_Robinson" "Anthony Robinson"

Although it seems to accept the entry, on the print itself it only ever
prints "Paul Jacques" regardless of the relevant name. What have I done wrong?
 
This sounds a tad bizarre unless you have not explained it well.
What difference does it make what the fieldnames are called? It is the
record content of those fields that matters.
Or do you really have a field called 'Name' which contains these underscored
names? In which case
{ IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield
Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } =
"Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would
probably be nearer the mark?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Hi Graham,

Yes the info is coming from a mergefield. I did originally start with a
variation of what you have provided. Sorry my description was a little
unclear. I'll give your example a try.

Thanks
 
Hi,

I've tried what you suggested but unfortunately, the field isn't big enough
to enter all of the statement. Is there anyway of abbreviating this or is
there somewhere else I can enter it?

Currently, I'm right-clicking the mergefield, then 'Edit Field', selecting
'If' from the 'Field names' list and then entering the statement in the
'Field Codes:' prompt.
 
You cannot enter a nested field of this complexity using the field tool.
You will have to enter from the keyboard using CTRL+F9 for each field
bracket pair.
Nake sure you get the brackets and the quotes in the right places or it
won't work - and don't do as I did originally and spell Mergefield
incorrectly ;)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Hi Paul,

As Graham suggests, you need to ensure that you get the curly brackets and
the quotes in the right places when you're creating your fields and this can
be quite tricky if you build up the fields in the "natural" left-to-right
way. For an alternative way to construct some types of nested IF fields which
I find to be easier to get right, check out the first parts of this thread:

http://groups.google.co.uk/group/mi...a79cb?lnk=st&q=&rnum=1&hl=en#6d5a1a841baa79cb

I won't duplicate the content here as I was just a tab verbose when I wrote
my part:-)

Regards.

Ed
 
Hi Ed,

"a tab verbose"??? Surely you meant "tad"!

Yes, Ed, I did. I spotted it a microsecond after I pressed the Post button.
Always the way:) Thanks for pointing it out.

I'm welcome.

Regards.

Ed
 
Hi Ed,

Many thanks for that. I have checked the thread and tried the following.
However, all that prints out is 'Mergefield'. I'm obviously still going wrong
somewhere:

{ if { Mergefield UserResponseAssignedTo } = "Orla_Byrne" "Orla Byrne" "{ IF
{Mergefield UserResponseAssignedTo } = "Brenda Corrigan" "Brenda Corrigan" "{
IF { Mergefield UserResponseAssignedTo } = "Ingrid_Dempsey" "Ingrid Dempsey"
"{ IF { Mergefield UserResponseAssignedTo } = "Laura_O'Carroll" "Laura
O'Carroll" "{ Mergefield UserResponseAssignedTo}" }" }" }" }

Thanks

Paul
 
Hi Paul,

To me the structure looks OK. Any chance you've used the curly brackets on
the keyboard to insert some of the field braces? When you create fields
manually you need to use CTRL+F9.

There are a couple of ways to tell. By default at least, the "true" field
braces look bolder than ordinary curly brackets. Also, try selecting each
field brace in turn and see what shows as selected.

My guess would be the final { Mergefield UserResponseAssignedTo}.

Regards.

Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top