limits on if statements

R

Robseym

Is there a limit to how many 'If_then_else' statements a mail merge document
can contain?


Rob
 
G

Graham Mayor

Only if you try and nest them.

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
R

Robseym

Thanks for that. it begs two further questions:

1) what is the limit on nested if statements?
2) How would you count the number of nested statements in the following
examples? - not written using the actual code:

I think the first statement is three nested, the second statement is only
two and the third contains no nested statements but I could be wrong.

1. IF([conditon], "text", "IF([condition2], "text", "IF([condition3],
"text", "")"" )

2. IF([conditon], "text", "IF([condition2], "text", "")IF([condition3],
"text", "")" )

3. IF([conditon], "text", "")IF([condition2], "text", "")IF([condition3],
"text", "")

Hope you can help as I am compiling a monster doc and don't want any nasty
surprises.

Rob
 
M

macropod

You can nest up to 20 IF fields in Word.

As for your examples, Word fields aren't coded quite like that. Turning them
into the correct structure:
1. {IF{conditon1}= TRUE "True text 1" {IF{conditon2}= TRUE "True text 2"
{IF{conditon3}= TRUE "True text 3" "False Text"}}}
all 3 conditions are nested
2. {IF{conditon1}= TRUE "True text 1" {IF{conditon2}= TRUE "True text 2"
"False Text 1"}{IF{conditon3}= TRUE "True text 3" "False Text 2"}}
the first two conditions are nested.
3. {IF{conditon1}= TRUE "True text 1" "False Text 1"}{IF{conditon2}= TRUE
"True text 2" "False Text 2"}{IF{conditon3}= TRUE "True text 3" "False Text
3"}
no conditions are nested.

If any of the 'FALSE' strings has no text, you can omit the double quotes
for them also. Empty 'TRUE' text strings must retain the double quotes,
though.

Cheers


Robseym said:
Thanks for that. it begs two further questions:

1) what is the limit on nested if statements?
2) How would you count the number of nested statements in the following
examples? - not written using the actual code:

I think the first statement is three nested, the second statement is only
two and the third contains no nested statements but I could be wrong.

1. IF([conditon], "text", "IF([condition2], "text", "IF([condition3],
"text", "")"" )

2. IF([conditon], "text", "IF([condition2], "text", "")IF([condition3],
"text", "")" )

3. IF([conditon], "text", "")IF([condition2], "text", "")IF([condition3],
"text", "")

Hope you can help as I am compiling a monster doc and don't want any nasty
surprises.

Rob

Graham Mayor said:
Only if you try and nest them.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
R

Robseym

Thank macropod looks like i'm going to be ok with that. I knew the coding was
different but I just wanted to make it easier to see, but that should help
others who look at this post.

Rob

macropod said:
You can nest up to 20 IF fields in Word.

As for your examples, Word fields aren't coded quite like that. Turning them
into the correct structure:
1. {IF{conditon1}= TRUE "True text 1" {IF{conditon2}= TRUE "True text 2"
{IF{conditon3}= TRUE "True text 3" "False Text"}}}
all 3 conditions are nested
2. {IF{conditon1}= TRUE "True text 1" {IF{conditon2}= TRUE "True text 2"
"False Text 1"}{IF{conditon3}= TRUE "True text 3" "False Text 2"}}
the first two conditions are nested.
3. {IF{conditon1}= TRUE "True text 1" "False Text 1"}{IF{conditon2}= TRUE
"True text 2" "False Text 2"}{IF{conditon3}= TRUE "True text 3" "False Text
3"}
no conditions are nested.

If any of the 'FALSE' strings has no text, you can omit the double quotes
for them also. Empty 'TRUE' text strings must retain the double quotes,
though.

Cheers


Robseym said:
Thanks for that. it begs two further questions:

1) what is the limit on nested if statements?
2) How would you count the number of nested statements in the following
examples? - not written using the actual code:

I think the first statement is three nested, the second statement is only
two and the third contains no nested statements but I could be wrong.

1. IF([conditon], "text", "IF([condition2], "text", "IF([condition3],
"text", "")"" )

2. IF([conditon], "text", "IF([condition2], "text", "")IF([condition3],
"text", "")" )

3. IF([conditon], "text", "")IF([condition2], "text", "")IF([condition3],
"text", "")

Hope you can help as I am compiling a monster doc and don't want any nasty
surprises.

Rob

Graham Mayor said:
Only if you try and nest them.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Robseym wrote:
Is there a limit to how many 'If_then_else' statements a mail merge
document can contain?


Rob
 

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

Top