Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Help with IF statements comparing more than two fields
I am trying to automate a task that is frequently done in my department. I have created a form in Word 2007 that asks the user about 10 pages of questions (some as yes/no, some as check boxes, some as open ended questions using text form fields). Based on their answers, a report will be automatically generated. My problem is that I would like to generate a specific line of text based on answers to three drop down questions. I can easily compare two, but cannot get it to work with a third added. I have searched for hours and have found similar questions, but no answers that have worked for my particular issue. Here is what I have so far (using Ctrl/Fn/F9)...
{IF{= AND ({COMPARE{Field1}= "No"}, {COMPARE{Field2}= "No"})= 1 "Desired Text" "Text if False"} This works but I cannot figure out how to add a third field comparison. I am unable to correctly nest the IF statements as suggested on a really old thread. Any help with an example would be greatly appreciated! Thank you. Christine |
#2
|
|||
|
|||
LOL! As soon as I posted this my husband, who writes macros for a living and previously told me he did not have time to help me with this, changed his mind. After 10 minutes of listening to him complain about the way things are written in Word, he fixed it for me. I am posting the solution to help others who may be looking for the answer like I was.
{IF{Field1}= "No" {IF{Field2}= "No" {IF{Field3}= "No" "Desired Statement" "Text if False"} "Text if False" } "Text if False" } Christine Quote:
|
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Help with IF statements comparing more than two fields
Hi,
{IF{= AND ({COMPARE{Field1}= "No"}, {COMPARE{Field2}= "No"})= 1 "Desired Text" "Text if False"} This works but I cannot figure out how to add a third field comparison. The COMPARE field just compares two conditions: http://office.microsoft.com/en-us/wo...005186141.aspx May be, just nested IF fields are helpful for you: IF first logical test = true, then second logical test. IF second logical text = true, then third logical test. IF third logical test = true, then .... -- Cheers, Lisa [MS MVP Word] |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Help with IF statements comparing more than two fields
On Monday, June 25, 2012 5:56:32 PM UTC-5, ChristineKD wrote:
I am trying to automate a task that is frequently done in my department. I have created a form in Word 2007 that asks the user about 10 pages of questions (some as yes/no, some as check boxes, some as open ended questions using text form fields). Based on their answers, a report will be automatically generated. My problem is that I would like to generate a specific line of text based on answers to three drop down questions. I can easily compare two, but cannot get it to work with a third added. I have searched for hours and have found similar questions, but no answers that have worked for my particular issue. Here is what I have so far (using Ctrl/Fn/F9)... {IF{= AND ({COMPARE{Field1}= "No"}, {COMPARE{Field2}= "No"})= 1 "Desired Text" "Text if False"} This works but I cannot figure out how to add a third field comparison. I am unable to correctly nest the IF statements as suggested on a really old thread. Any help with an example would be greatly appreciated! Thank you. Christine -- ChristineKD I was able to do something like this: { IF { = OR ( { COMPARE { MERGEFIELD } = "Value1" }, { = OR ( { COMPARE { MERGEFIELD } = "Value2" }, { COMPARE { MERGEFIELD } = "Value3" } ) } ) } = 1 "Result1" "Result2" } |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with If statements in a Word Table using Form fields | Microsoft Word Help | |||
IF Statements in Word Fields | Microsoft Word Help | |||
Merge fields in IF statements not working | Microsoft Word Help | |||
IF Statements and REF Fields | Microsoft Word Help | |||
IF Fields With AND Statements | Microsoft Word Help |