Function IF AND OR (main Value cell) nested to multiples cells to get exact Result

AndyJR

Board Regular
Joined
Jun 20, 2015
Messages
90
Hi,

I trying to display depending on values from Main cell (cell C) nested with Multiples cell, so far a i have good result but i still need to add a criteria on more cells with some values.
i made a short formula that is working :
Code:
=IF(AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="1",E4="0"),"Stay","AWAY")

But to existing formula i need to add multiples different values of Cell D and E to get a correct display :

Example : If
C4 have One of these Value-> 000, 001, 002, 010, 011
and
D4 have --> 1
and
E4 have --> 1
and
F4 have --> 3
then Display -> "Stay" if FALSE then "AWAY"

Then at same Formula i need to add last part of the formula for Cell D4, E4 and F4 with different values, example
Cell (D4 have --> 2, E4 have --> 1, F4 have --> 2 )
Within the same formula but with out adding the Long formula applied to C4
(can i do that?)

Thank you very much for any help (or link suggestion)
 
Last edited:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
try

=OR(AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="1",E4="0"),AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="1",E4="1",F4="3"),AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="2",E4="1",F4="2"))

NOT that "000" is a text value and not a number 0
where you have put "" the formula is looking for text and not numbers
 
Last edited:
Upvote 0
Hi etaf

Just asking, On your formula where exact i write the text "Stay", "away" ("Stay" if TRUE or "away" if FALSE) ?

Rich (BB code):
=OR(AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="1",E4="0"),AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="1",E4="1",F4="3"),AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="2",E4="1",F4="2"))


Thanks
 
Upvote 0
Andy,
If etaf's formula is giving you the exact result then you can embed it in IF function like this

=IF(OR(AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="1",E4="0"),AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="1",E4="1",F4="3"),AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="2",E4="1",F4="2")),"Stay","Away")
 
Upvote 0
in your original formula


=IF(AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="1",E4="0"),"Stay","AWAY")

you are replacing the AND(............) in your formula with the OR in mine

so
in your original formula


=IF(OR(AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="1",E4="0"),AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="1",E4="1",F4="3"),AND(OR(C4="000",C4="001",C4="002",C4="010",C4="011"),D4="2",E4="1",F4="2")),"Stay","AWAY")

but "2" is not the same as 2
so "2" is text 2
2 is number
 
Last edited:
Upvote 0
Andy,
do the cells contain numbers or text? why have you written the numbers in column D, E and F in those inverted commas?

if it is in text format then it's okay otherwise you can write it directly
 
Upvote 0
Hi snjpverma,

Yes, the column D,E and F are numbers, i'll write it direct.

Thank you so much!!
 
Upvote 0
I am not sure, but see if this formula returns the same result?

=IF(AND(OR(C4={"000","001","002","010","011"}),OR(D4={1,2}),OR(E4={0,1}),OR(F4={2,3})),"Stay","AWAY")
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top