Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-18-2014, 02:15 PM
JLA JLA is offline Mail Merge IF-THEN-ELSE rule Windows 7 64bit Mail Merge IF-THEN-ELSE rule Office 2010 64bit
Novice
Mail Merge IF-THEN-ELSE rule
 
Join Date: Nov 2014
Posts: 1
JLA is on a distinguished road
Default Mail Merge IF-THEN-ELSE rule

Is it possible to include an "OR" in an IF-THEN-ELSE rule for a mail merge letter? I want to do something like this:



IF mergefield A is blank OR mergefield B = "No" THEN "xx" ELSE "yy"

Any help with code for this much appreciated!
Reply With Quote
  #2  
Old 11-18-2014, 04:24 PM
macropod's Avatar
macropod macropod is offline Mail Merge IF-THEN-ELSE rule Windows 7 64bit Mail Merge IF-THEN-ELSE rule Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You can build quite complex AND & OR tests with field coding.

For AND tests you can use field coding like:
{IF{={IF{MERGEFIELD Field1}= Y 1 0}*{IF{MERGEFIELD Field2}= "" 1 0}}= 1 "True Text" "False Text"}

{IF{={IF{MERGEFIELD Field1}= Y 1 0}*{IF{MERGEFIELD Field2}= "" 1 0}*{IF{MERGEFIELD Field3}= "" 1 0}}= 1 "True Text" "False Text"}
etc.
or:
{IF{={IF«Field1»= Y 1 0}*{IF«Field2»= "" 1 0}}= 1 "True Text" "False Text"}

{IF{={IF«Field1»= Y 1 0}*{IF«Field2»= "" 1 0}*{IF«Field3»= "" 1 0}}= 1 "True Text" "False Text"}
etc.

For OR tests you can use field coding like:
{IF{={IF{MERGEFIELD Field1}= Y 1 0}+{IF{MERGEFIELD Field2}= "" 1 0}}> 0 "True Text" "False Text"}

{IF{={IF{MERGEFIELD Field1}= Y 1 0}+{IF{MERGEFIELD Field2}= "" 1 0}+{IF{MERGEFIELD Field3}= "" 1 0}}> 0 "True Text" "False Text"}
etc.
or:
{IF{={IF«Field1»= Y 1 0}+{IF«Field2»= "" 1 0}}> 0 "True Text" "False Text"}

{IF{={IF«Field1»= Y 1 0}+{IF«Field2»= "" 1 0}+{IF«Field3»= "" 1 0}}> 0 "True Text" "False Text"}
etc.

With the OR tests, changing the final 0 to another number can be used to specify that more than one condition must be met. Setting it to the same as the number of IF tests turns it into an AND test. With care, you can also combine the AND & OR tests.

Note: The field brace pairs (i.e. '{ }') for the above examples 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 practicable to add them via any of the standard Word dialogues. Likewise, you can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar. The spaces represented in the field construction are all required.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
mail merge help, mail merge issue, mail merge; if; fill-in



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge IF-THEN-ELSE rule Mail Merge in Word: creating a rule for blanks cgranada Mail Merge 6 02-27-2017 09:08 AM
Problem with delay outgoing mail rule maverick1714 Outlook 0 09-30-2014 12:15 AM
Mail merge how to link mail merge field value to a column heading dsummers Mail Merge 1 05-08-2014 02:59 PM
Mail Merge IF-THEN-ELSE rule Rule for reading notification E-Mail balubeto Outlook 2 07-27-2012 10:47 AM
modifying rule to show new mail envelope in task bar mlov83 Outlook 5 02-11-2011 01:36 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft