Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 10-13-2017, 10:16 PM
jriker1 jriker1 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Posts: 3
jriker1 is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 10-13-2017, 11:24 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,353
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

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: http://www.msofficeforums.com/mail-m...ps-tricks.html
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 10-13-2017, 11:44 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,353
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

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
[MS MVP - Word]
Reply With Quote
  #4  
Old 10-14-2017, 07:34 AM
jriker1 jriker1 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Posts: 3
jriker1 is on a distinguished road
Default

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
Reply With Quote
  #5  
Old 10-14-2017, 08:26 AM
jriker1 jriker1 is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2017
Posts: 3
jriker1 is on a distinguished road
Default

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
Reply With Quote
  #6  
Old 10-14-2017, 01:11 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,353
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Quote:
Originally Posted by jriker1 View Post
Noticed there is an extra end/right squiggly bracket vs the start/left brackets.
No, there isn't - they're exactly balanced.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply
Please reply to this thread with any new information or opinions.

Thread Tools
Display Modes


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 4 11-21-2010 08:10 AM


All times are GMT -7. The time now is 02:36 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft