IF(AND(...)) question

ranl

New Member
Joined
May 13, 2003
Messages
2
Hi.
I'm using this function:

=IF(AND(C13=0,B13=0),0,IF(AND(C13=1,B13=0),1,IF(AND(C13=2,B13=0),2,IF(AND(C13=1,B13=1),1,IF(AND(C13=2,B13=1),"Unknown",IF(AND(C13=0,B13=2),2,IF(AND(C13=0,B13=1),1,2)))))))

currently, raws "B" and "C" have the values 0,1,2.
This function works fine on raw "A".
The problem occures when I'm adding my final "IF" - as always, just before the "UK", so it looks like this:

=IF(AND(C22=0,B22=0),0,IF(AND(C22=1,B22=0),1,IF(AND(C22=2,B22=0),2,IF(AND(C22=1,B22=1),1,IF(AND(C22=2,B22=1),"Unknown",IF(AND(C22=0,B22=2),2,IF(AND(C22=0,B22=1),1,if(and(C22=1,B22=2),"Unknown",2))))))))

I keep getting an error: "The formula you typed contains an error".



Is there an "AND" usage limit?
any ideas?

Thanks.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
... and you could combine your first 3 IF clauses into 1 by typing:

IF(B13=0,C13)

thereby reducing the number of IFs to 6. Further simplification might be possible.
 
Upvote 0
Take a look at the Index to 485 articles at the bottom of the main page.
Then go to the Excel Formulas section. You should be able to find a workaround for the & level limitation.

Good luck.

Ben
 
Upvote 0
=VLOOKUP(SUMPRODUCT(B22:C22,{10,1}),{0,0;1,1;2,2;10,1;11,1;12,"Unknown";20,2;21,"Unknown";22,2},2,0)
 
Upvote 0
Look at Aladin's response to me earlier query "Nested if statements", think it's what your after.
 
Upvote 0
=IF(COUNTIF(B22:C22,0),MAX(B22:C22),IF(SUM(B22:C22)<=2,MIN(B22:C22),"Unknown"))

It will also result in "Unknown" when B22=2 and C22=2.
 
Upvote 0

Forum statistics

Threads
1,221,691
Messages
6,161,322
Members
451,696
Latest member
Senthil Murugan

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