Home |
Search |
Today's Posts |
|
#1
|
|||
|
|||
nested if then else
How can I create a nested "if then else"? I need to test for 2 criteria. If
that is true I need to print a certain address block. If that is false, I need to print a different address block. |
#2
|
|||
|
|||
Lets say you have bookmark A and Bookmark B. If Bookmark A = "This"
AND BookMark B = "This" then the field will return "This" ELSE the field returns "That" {IF{REF A}="This"{IF{REF B}="This""This""That"}"That"} |
#3
|
|||
|
|||
Now lets suppose I am inserting mergefields. If bookmark A = "This" and
bookmark B = "That" I want to print 3 merge fields. If bookmark A = "That" and bookmark B = "This" then I want to print 3 different merge fields. "Greg" wrote: Lets say you have bookmark A and Bookmark B. If Bookmark A = "This" AND BookMark B = "This" then the field will return "This" ELSE the field returns "That" {IF{REF A}="This"{IF{REF B}="This""This""That"}"That"} |
#4
|
|||
|
|||
Vaughn,
For brevity lets call the mergerfields 1 2 3 4 5 6 and abbreviate Mergefield as MF {IF {A}="This"{IF{B}="That""{MF 1}{MF 2}{{MF 3}""{MF 4}{MF 5}{MF 6}"}""{MF 4}{MF 5}{MF 6}"} |
#5
|
|||
|
|||
What I get is MF1 and not MF2 and MF3. I don't understand the last sequence
of MF4 MF5 and MF6. "Greg" wrote: Vaughn, For brevity lets call the mergerfields 1 2 3 4 5 6 and abbreviate Mergefield as MF {IF {A}="This"{IF{B}="That""{MF 1}{MF 2}{{MF 3}""{MF 4}{MF 5}{MF 6}"}""{MF 4}{MF 5}{MF 6}"} |
#6
|
|||
|
|||
Using Greg's example with changes to test on the value of MF 7 & 8:
{IF {MF 7}="This"{IF {MF 8}="That""{MF 1}{MF 2}{{MF 3}""{MF 4}{MF 5}{MF 6}"}""{MF 4}{MF 5}{MF 6}"} Your false value for MF 7 = "This" is: {MF 4}{MF 5}{MF 6} Your true value for MF 7 = "This" depends on the value of MF 8 Your false value for MF 8 = "That" is: {MF 4}{MF 5}{MF 6} Your true value for MF 8 = "That" is: {MF 1}{MF 2}{{MF 3} This isn't difficult, but you do have to keep track of what is where in which field. -- Charles Kenyon Word New User FAQ & Web Directory: http://addbalance.com/word Intermediate User's Guide to Microsoft Word (supplemented version of Microsoft's Legal Users' Guide) http://addbalance.com/usersguide See also the MVP FAQ: http://www.mvps.org/word which is awesome! --------- --------- --------- --------- --------- --------- This message is posted to a newsgroup. Please post replies and questions to the newsgroup so that others can learn from my ignorance and your wisdom. "Vaughn" wrote in message ... What I get is MF1 and not MF2 and MF3. I don't understand the last sequence of MF4 MF5 and MF6. "Greg" wrote: Vaughn, For brevity lets call the mergerfields 1 2 3 4 5 6 and abbreviate Mergefield as MF {IF {A}="This"{IF{B}="That""{MF 1}{MF 2}{{MF 3}""{MF 4}{MF 5}{MF 6}"}""{MF 4}{MF 5}{MF 6}"} |
#7
|
|||
|
|||
Vaugh,
If the condition is met you want to print three mergefields (1, 2, and 3) If the condition is not met you said that you wanted to print three different mergefields. I arbitrarily called those 4, 5, and 6. Try this: { IF "1" = "1""{ IF "2"="2""{ IF "3"="3""True""False"}""False" }""False" } Remember all brace pairs { } are entered with CTRL+F9 This should help you see the strucure of the nested fields. Change the conditions to see how it reacts. -- Greg Maxey/Word MVP A Peer in Peer to Peer Support http://gregmaxey.mvps.org/word_tips.htm Vaughn wrote: What I get is MF1 and not MF2 and MF3. I don't understand the last sequence of MF4 MF5 and MF6. "Greg" wrote: Vaughn, For brevity lets call the mergerfields 1 2 3 4 5 6 and abbreviate Mergefield as MF {IF {A}="This"{IF{B}="That""{MF 1}{MF 2}{{MF 3}""{MF 4}{MF 5}{MF 6}"}""{MF 4}{MF 5}{MF 6}"} |
#8
|
|||
|
|||
I'm beginning to think I have to do the "if" for each and every field that I
want to print. "Greg" wrote: Lets say you have bookmark A and Bookmark B. If Bookmark A = "This" AND BookMark B = "This" then the field will return "This" ELSE the field returns "That" {IF{REF A}="This"{IF{REF B}="This""This""That"}"That"} |
#9
|
|||
|
|||
Word's Help file includes examples of nested IF fields.
-- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Vaughn" wrote in message news How can I create a nested "if then else"? I need to test for 2 criteria. If that is true I need to print a certain address block. If that is false, I need to print a different address block. |
#10
|
|||
|
|||
I was just about to reply and say that I have searched and searched for
nested ifs (and I have), but I went into help again and there it was. Like magic. This thread has taken a strange turn. I still seem to have a problem with all 3 fields printing and will post back after further testing. Thanks for the simple nudge to the help file again. "Suzanne S. Barnhill" wrote: Word's Help file includes examples of nested IF fields. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Vaughn" wrote in message news How can I create a nested "if then else"? I need to test for 2 criteria. If that is true I need to print a certain address block. If that is false, I need to print a different address block. |
#11
|
|||
|
|||
If you are inserting fields manually, then don't forget you need to use
CTRL+F9 for the field boundaries. If you are still having problems, post back the actual fieldnames and conditions that you wish to use. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Vaughn wrote: I was just about to reply and say that I have searched and searched for nested ifs (and I have), but I went into help again and there it was. Like magic. This thread has taken a strange turn. I still seem to have a problem with all 3 fields printing and will post back after further testing. Thanks for the simple nudge to the help file again. "Suzanne S. Barnhill" wrote: Word's Help file includes examples of nested IF fields. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Vaughn" wrote in message news How can I create a nested "if then else"? I need to test for 2 criteria. If that is true I need to print a certain address block. If that is false, I need to print a different address block. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I set up nested numbered headings in Word (1.1, 1.2, 2.1, . | Microsoft Word Help | |||
Help with nested tables | Tables | |||
How do I "un-nest" a table from nested tables? | Tables | |||
# Range inside "Nested If" Statement | Mailmerge |