ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   IF _ AND _ OR (https://www.excelbanter.com/excel-discussion-misc-queries/245759-if-_-_.html)

Oldjay

IF _ AND _ OR
 
I give up. I can't get the correct formula

If A1 =1 And A2 OR A3 =2 then A4 =4 otherwise A4 =""



smartin

IF _ AND _ OR
 
oldjay wrote:
I give up. I can't get the correct formula

If A1 =1 And A2 OR A3 =2 then A4 =4 otherwise A4 =""


Do be careful how you explain logical conundrums.

Strictly speaking, your question should be parsed as

If (A1 =1 And A2) OR A3 =2 then A4 =4 otherwise A4 =""

because AND takes precedence over OR.

Somehow I think you really meant

If A1 =1 And (A2 =2 OR A3 =2) then A4 =4 otherwise A4 =""

In which case I would write in A4:

T. Valko

IF _ AND _ OR
 
Try this:

=IF(AND(A1=1,OR(A2=2,A3=2)),4,"")

--
Biff
Microsoft Excel MVP


"oldjay" wrote in message
...
I give up. I can't get the correct formula

If A1 =1 And A2 OR A3 =2 then A4 =4 otherwise A4 =""





smartin

IF _ AND _ OR
 
smartin wrote:
oldjay wrote:
I give up. I can't get the correct formula

If A1 =1 And A2 OR A3 =2 then A4 =4 otherwise A4 =""


Do be careful how you explain logical conundrums.

Strictly speaking, your question should be parsed as

If (A1 =1 And A2) OR A3 =2 then A4 =4 otherwise A4 =""

because AND takes precedence over OR.

Somehow I think you really meant

If A1 =1 And (A2 =2 OR A3 =2) then A4 =4 otherwise A4 =""

In which case I would write in A4:


=IF(AND(A1=1,OR(A2=2,A3=2)),4,"")

Sorry about the cliff-hanger!

FloMM2

IF _ AND _ OR
 
oldjay,
Another solution:
"=IF(A1=1*AND(A2=2),4,IF(A1=1*AND(A3=2),4,"")) "
hth
:-)
"oldjay" wrote:

I give up. I can't get the correct formula

If A1 =1 And A2 OR A3 =2 then A4 =4 otherwise A4 =""



David Biddulph[_2_]

IF _ AND _ OR
 
Perhaps you could explain to us what the AND function does for you in that
formula?
In what way does 1*AND(A=2) differ from 1*(A=2) ?
--
David Biddulph

FloMM2 wrote:
oldjay,
Another solution:
"=IF(A1=1*AND(A2=2),4,IF(A1=1*AND(A3=2),4,"")) "
hth
:-)
"oldjay" wrote:

I give up. I can't get the correct formula

If A1 =1 And A2 OR A3 =2 then A4 =4 otherwise A4 =""





All times are GMT +1. The time now is 06:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com