#1
|
|||
|
|||
if true AND nested or?
Trying to do a mail merge and can't figure this one out. Basically is: If card = "Yes" AND (Donate = "Yes" or Amount <> "" or merit = "Yes") print "whatever I'm going to print". So card needs to be yes for starters, and then if any of the conditions in the brackets are true then print otherwise do nothing. How would I do this? Thanks. JR |
#2
|
||||
|
||||
You could use a field coded as:
{IF{={IF{MERGEFIELD Card}= "Yes" 1 0}*(({IF{MERGEFIELD Donate}= "Yes" 1 0}+{IF{MERGEFIELD Merit}= "Yes" 1 0}+{IF{MERGEFIELD Amount \# 0}= 0 0 1})>0)}= 1 "True Text" "False Text"} Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. The spaces represented in the field constructions are all required. There is a macro for turning the above into a working field code in the Mailmerge Tips & Tricks 'Sticky' thread at the top of this forum: https://www.msofficeforums.com/mail-...ps-tricks.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
Cross-posted at: https://answers.microsoft.com/en-us/...5-c6f8276485dc
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
Thanks macropod. I'll give it a try. Noticed there is an extra end/right squiggly bracket vs the start/left brackets. Have to figure where that is.
Thanks. JR |
#5
|
|||
|
|||
Also I'm using ctrl-F9 for all the {} however this passes and this gives an Unknown op code when testing:
Pass: {IF{IF{MERGEFIELD Card}="Yes" 1 0} = 1 "HI"} OP Error: {IF{IF{MERGEFIELD Card}="Yes" 1 0}+{IF{MERGEFIELD Card}="Yes" 1 0} = 1 "HI"} JR |
#6
|
||||
|
||||
No, there isn't - they're exactly balanced.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Converting a 1 or 0 into TRUE or FALSE? | ayupchap | Mail Merge | 1 | 04-25-2017 02:45 PM |
True 4:3 background dimensions | a_gunslinger | PowerPoint | 1 | 11-28-2016 08:22 PM |
Search for character border = true ? | n00bie-n00b | Word VBA | 6 | 10-08-2014 11:54 PM |
True Title Case for First Row of All Tables | Marrick13 | Word VBA | 14 | 12-11-2013 09:12 PM |
Macro not staying true | oluc | Word VBA | 4 | 11-21-2010 08:10 AM |