#1
|
|||
|
|||
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
|
#2
|
||||
|
||||
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] |
#3
|
||||
|
||||
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] |
#4
|
|||
|
|||
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.
|
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 |
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 |