Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
combine IF, AND and OR operstors in a statement
How do I nest AND & OR operators in an IF statement? E.g. the statement
=IF(AND(OR(I16="Y",I16="?"),I24="?"),"Please enter country code","ERROR") creates an error |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
combine IF, AND and OR operstors in a statement
I just tested this and it worked as advertised when i24 contained ? and i16
either y or ? =IF(AND(OR(I16="Y",I16="?"),I24="?"),"Please enter country code","MM") -- Don Guillett Microsoft MVP Excel SalesAid Software "Vince" wrote in message ... How do I nest AND & OR operators in an IF statement? E.g. the statement =IF(AND(OR(I16="Y",I16="?"),I24="?"),"Please enter country code","ERROR") creates an error |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
combine IF, AND and OR operstors in a statement
On Dec 19, 11:26 am, Vince wrote:
How do I nest AND & OR operators in an IF statement? E.g. the statement =IF(AND(OR(I16="Y",I16="?"),I24="?"),"Please enter country code","ERROR") creates an error Do you mean an Excel error message; or do you mean the word "ERROR"? I do not get any Excel error message when I cut-and-paste what you wrote above into an Excel spreadsheet. Perhaps you have a typo in your spreadsheet that you did not repeat when you wrote your posting. You might try replacing your spreadsheet formula by cut-and-pasting from your posting, as I did. If you mean you got the word "ERROR", of course there could be an error in your logic. To determine that, I would need to know what values you have in I16 and I24 or a precise specification of your expectations for all combination of the contents of I16 and I24. |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
combine IF, AND and OR operstors in a statement
It's kind of confusing to know what you mean when you said ""creates an
error" given that if the logical test is not met, you return the word "ERROR". Anyway, I tried your code and it does what it says... if I16 has either a "Y" or "?" in it AND if I24 has a "?", then "Please enter country code" is display; if either of those cells contain anything else, the word "ERROR" is returned... the code does work and no worksheet errors are generated. What is it you thought should happen that prompted you to post your question? Rick "Vince" wrote in message ... How do I nest AND & OR operators in an IF statement? E.g. the statement =IF(AND(OR(I16="Y",I16="?"),I24="?"),"Please enter country code","ERROR") creates an error |
#5
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
combine IF, AND and OR operstors in a statement
What error
the formula says if (I16=Y or ?) AND I24=? then return 'Please enter country code' and if those econditions aren't met return ERROR and that works What are you expecting to happen? Mike "Vince" wrote: How do I nest AND & OR operators in an IF statement? E.g. the statement =IF(AND(OR(I16="Y",I16="?"),I24="?"),"Please enter country code","ERROR") creates an error |
#6
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
combine IF, AND and OR operstors in a statement
Thanks - yes it does work - my bloodshot eye focus must have been playing up.
In the office at 7am today and still at the computer at 10.20 ! Sad or what? "Don Guillett" wrote: I just tested this and it worked as advertised when i24 contained ? and i16 either y or ? =IF(AND(OR(I16="Y",I16="?"),I24="?"),"Please enter country code","MM") -- Don Guillett Microsoft MVP Excel SalesAid Software "Vince" wrote in message ... How do I nest AND & OR operators in an IF statement? E.g. the statement =IF(AND(OR(I16="Y",I16="?"),I24="?"),"Please enter country code","ERROR") creates an error |
#7
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
combine IF, AND and OR operstors in a statement
Excel error message. Thanks - yes it does work - my bloodshot eye focus must
have been playing up. In the office at 7am today and still at the computer at 10.20 ! Sad or what? "Mike H" wrote: What error the formula says if (I16=Y or ?) AND I24=? then return 'Please enter country code' and if those econditions aren't met return ERROR and that works What are you expecting to happen? Mike "Vince" wrote: How do I nest AND & OR operators in an IF statement? E.g. the statement =IF(AND(OR(I16="Y",I16="?"),I24="?"),"Please enter country code","ERROR") creates an error |
#8
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
combine IF, AND and OR operstors in a statement
Excel error. It does work - my bloodshot eye focus must have been playing
up. In the office at 7am today and still at the computer at 10.20 ! Sad or what? "joeu2004" wrote: On Dec 19, 11:26 am, Vince wrote: How do I nest AND & OR operators in an IF statement? E.g. the statement =IF(AND(OR(I16="Y",I16="?"),I24="?"),"Please enter country code","ERROR") creates an error Do you mean an Excel error message; or do you mean the word "ERROR"? I do not get any Excel error message when I cut-and-paste what you wrote above into an Excel spreadsheet. Perhaps you have a typo in your spreadsheet that you did not repeat when you wrote your posting. You might try replacing your spreadsheet formula by cut-and-pasting from your posting, as I did. If you mean you got the word "ERROR", of course there could be an error in your logic. To determine that, I would need to know what values you have in I16 and I24 or a precise specification of your expectations for all combination of the contents of I16 and I24. |
#9
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
combine IF, AND and OR operstors in a statement
Sorry - I meant an excel error. It does work - my bloodshot eye focus must
have been playing up. In the office at 7am today and still at the computer at 10.20 ! Sad or what? "Rick Rothstein (MVP - VB)" wrote: It's kind of confusing to know what you mean when you said ""creates an error" given that if the logical test is not met, you return the word "ERROR". Anyway, I tried your code and it does what it says... if I16 has either a "Y" or "?" in it AND if I24 has a "?", then "Please enter country code" is display; if either of those cells contain anything else, the word "ERROR" is returned... the code does work and no worksheet errors are generated. What is it you thought should happen that prompted you to post your question? Rick "Vince" wrote in message ... How do I nest AND & OR operators in an IF statement? E.g. the statement =IF(AND(OR(I16="Y",I16="?"),I24="?"),"Please enter country code","ERROR") creates an error |
#11
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
combine IF, AND and OR operstors in a statement
Sorry - I meant an excel error. It does work - my bloodshot eye focus
must have been playing up. But, if I understand you correctly, you are not getting an Excel error any more, right? In the office at 7am today and still at the computer at 10.20 ! Sad or what? Well, if that 10:20 time were in the AM, it wouldn't be that sad; but I am guessing that is not the case, eh? <g Rick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can an If statement answer an If statement? | Excel Discussion (Misc queries) | |||
HLookup, IF statement, multiple sort, somehow combine all of these | Excel Worksheet Functions | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions | |||
If statement and Isblank statement | Excel Worksheet Functions | |||
Help please, IF statement/SUMIF statement | Excel Worksheet Functions |