Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-30-2016, 03:48 PM
mawallace mawallace is offline can you nest OR in an if command Windows 7 64bit can you nest OR in an if command Office 2010 32bit
Novice
can you nest OR in an if command
 
Join Date: Jun 2012
Posts: 6
mawallace is on a distinguished road
Default can you nest OR in an if command

I want a paragraph to display if the field in the source is one of two values. It make sense to have IF test 1 OR test w = 1 then etc etc. Is this possible to use OR AND 3rd and if so what's the correct syntax
Reply With Quote
  #2  
Old 11-30-2016, 08:42 PM
macropod's Avatar
macropod macropod is offline can you nest OR in an if command Windows 7 64bit can you nest OR in an if command Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

The simplest approach is to nest the fields or use independent fields. For example:
{IF«MyField»= "Option1" "Output for Option1 & 2"}{IF«MyField»= "Option2" "Output for Option1 & 2"}
or:
{IF«MyField»<> "Option1" {IF«MyField»= "Option2" "Output when neither Option1 nor Option2" "Output for Option1 & 2"}}
The first is simpler when nothing is to be output when either option is false; the second when there is always an output.

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. 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 'Insert Merge Field' dropdown. The spaces represented in the field construction are all required.

That said, there are ways of combining multiple AND and/or OR conditions. To see how to do that and a wide range of other calculations in Word, check out my Microsoft Word Field Maths Tutorial, at:
http://windowssecrets.com/forums/sho...Maths-Tutorial
or:
http://www.gmayor.com/downloads.htm#Third_party
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-01-2016, 04:54 PM
macropod's Avatar
macropod macropod is offline can you nest OR in an if command Windows 7 64bit can you nest OR in an if command Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Cross-posted at: http://windowssecrets.com/forums/sho...-on-mail-merge
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 12-07-2016, 04:37 PM
Charles Kenyon Charles Kenyon is offline can you nest OR in an if command Windows 8 can you nest OR in an if command Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

It may be more work than you wanted, but you've received the best advice on the way to do what you want from Paul.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with a Command Button dkohnken Word VBA 5 03-18-2015 10:13 PM
can you nest OR in an if command Nest IF statements with a text comma inbetween each IF statement AClaborn Excel 2 01-20-2015 12:07 PM
Add Command to Bar neiljsalkind Excel 0 02-03-2012 08:31 AM
Add-In:How to add command right click command bar phang Outlook 0 01-15-2007 02:53 AM
command buttons ronf Excel 0 12-03-2005 06:26 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:04 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