Nested formula problem

wmtsub

Active Member
Joined
Jun 20, 2018
Messages
322
What am I doing wrong here?

=IF((AND(X3<4,X3>2)),if(AND(y3<4,y3>2)),"YES","NO")
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try:
Code:
=IF((AND(X3<4,X3>2)),if(AND(y3<4,y3>2[COLOR=#ff0000])[/COLOR],"YES","NO")[COLOR=#b22222])[/COLOR]
 
Upvote 0
if

=IF((AND(X3<4,X3>2)) is false what do you want

=IF ( TEST , TRUE , FALSE)

you have a NEST in TRUE - so need

=IF( TEST , IF( TEST , TRUE , FALSE ) , FALSE )


 
Upvote 0
How can I expand this for five cells?
Tried this but no go. This will be the entire code.
=IF((AND(X3<4,X3>2)),IF(AND(Y3<4,Y3>2),IF(AND(Z3<4,Z3>2),IF(AND(AA3<4,AA3>2),IF(AND(AB3<4,AB3>2),"YES","NO")))))
 
Upvote 0
i would use an OR or AND
just want to check that in Order to get a YES

AND(X3<4,X3>2) AND AND(Y3<4,Y3>2 AND AND(Z3<4,Z3>2 etc
so would
AND(X3<4,X3>2, Y3<4,Y3>2, Z3<4,Z3>2, AA3<4,AA3>2, AB3<4,AB3>2) ALL have to be TRUE to get a YES ?

 
Upvote 0
I would check the entire range at once:

=IF(COUNTIFS(X3:AB3,">2",X3:AB3,"<4")=5,"Yes","No")
 
Upvote 0
Thanks guy's. Options I did not even know about. Thought I could build out the formula based on having two work. Seems I can't. I am in over my head.
Ultimately what I was hoping for was to search five cells for four conditions with different results.
So if:
Any cell in the range falls between 14 and 8 result 1
Any cell in the range falls between 7 and 0 result 2
Any cell in the range falls between -1 and -3 result 3
Any cell in the range falls between -7 and greater [lesser?] result 4

is this possible?
 
Upvote 0
Thanks for the feedback, I got it worked out.
=IF(AND(X3<15,X3>7),"1",IF(AND(X3<80,X3>0),"2",IF(AND(X3<0,X3>-3),"3",IF(AND(X3<-3,X3>-3),"4","N"))))
 
Upvote 0
You shouldn't put numbers in quotes, that makes them text.
=IF(AND(X3<15,X3>7),1,IF(AND(X3<80,X3>0),2,IF(AND(X3<0,X3>-3),3,IF(AND(X3<-3,X3>-3),4,"N"))))

Your last choice doesn't make sense though how can X3 be less than -3 and greater than -3? Also X3<80 isn't in your example of what you're checking for.

You may want to look at VLOOKUP though:
=IFERROR(VLOOKUP(X3,{-7,4;-1,3;0,2;8,1},2,1),"N")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,806
Members
449,048
Latest member
greyangel23

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