Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Nested IF statements - maxed out!

I currently have the following formula in a cell:
IF(AND(J40=12,J41="YES"),"Multiple",IF(J39="","",I F(AND(B48="NO",J40=6),SUM(B39,B41,B43)*3,IF(B48="Y ES",SUM(B49:B52,B41,B43,B43,B45),IF(AND(B46="YES", D54="YES"),(((+B39+B41+B43)*2)+B45),IF(B46="YES",( ((+B39+B41+B43)*4)+B45),IF(D54="YES",(((+B39+B41+B 43)*2)+B45),(((+B39+B41+B43)*4)+B45+B45))))))))

I want to add another condition: IF(AND(J40=4,B48="YES"),(B50+B51)*2)

Any ideas on how to get past the limitation of 7? Maybe a better, more
condensed, way to write the formula?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,089
Default Nested IF statements - maxed out!

I don't think you can get past the limitation, unless that's a feature in
Excel 2007

I can't really test this because I don't understand the logic and I don't
have the data. But, splitting it down, you see:

IF(AND(J40=12,J41="YES"),"Multiple",
IF(J39="","",
IF(AND(B48="NO",J40=6),SUM(B39,B41,B43)*3,
IF(B48="YES",SUM(B49:B52,B41,B43,B43,B45),
IF(AND(B46="YES",D54="YES"),(((+B39+B41+B43)*2)+B4 5),
IF(B46="YES",(((+B39+B41+B43)*4)+B45),
IF(D54="YES",(((+B39+B41+B43)*2)+B45),
(((+B39+B41+B43)*4)+B45+B45))))))))

It looks as though two conditions have the same result:

IF(AND(B46="YES",D54="YES"),(((+B39+B41+B43)*2)+B4 5),
IF(D54="YES",(((+B39+B41+B43)*2)+B45),

So, maybe you could combine them, removing one of the IF statements:

IF(OR(AND(B46="YES",D54="YES"),D54="YES"),(((+B39+ B41+B43)*2)+B45),

I think that might mean the B46="YES" test is redundant but I'm not sure.

Anyway, if that works, you can add another IF statement.

I have to be honest and say that I think this will be a nightmare to check
and prove. And, in a few months time you'll probably have no idea what you
were trying to do. More to the point, neither will anyone else.

As an example, you seem to have some repetition of cells:

IF(B48="YES",SUM(B49:B52,B41,B43,B43,B45), 2 x B43
(((+B39+B41+B43)*4)+B45+B45)))))))) 2 x +B45

But, I'm sure you know what you're trying to do ... at least for the moment

Regards

Trevor


"RRDMAT" wrote in message
...
I currently have the following formula in a cell:
IF(AND(J40=12,J41="YES"),"Multiple",IF(J39="","",I F(AND(B48="NO",J40=6),SUM(B39,B41,B43)*3,IF(B48="Y ES",SUM(B49:B52,B41,B43,B43,B45),IF(AND(B46="YES", D54="YES"),(((+B39+B41+B43)*2)+B45),IF(B46="YES",( ((+B39+B41+B43)*4)+B45),IF(D54="YES",(((+B39+B41+B 43)*2)+B45),(((+B39+B41+B43)*4)+B45+B45))))))))

I want to add another condition: IF(AND(J40=4,B48="YES"),(B50+B51)*2)

Any ideas on how to get past the limitation of 7? Maybe a better, more
condensed, way to write the formula?



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 964
Default Nested IF statements - maxed out!

Excel 2007 does increase the nesting limit to 64 levels. But, upgrading to
2007 may not be an option for you at this time.

Trevor's suggestion to eliminate redundancies is good advice, and may be
adequate for your immediate needs.

However, here's a trick to get around the nesting limitations in older
versions of Excel. You can concatenate multiple IF statements together,
rather than nesting inside of one another.

=IF(A1="A","TRUE","")&IF(A1=""B","TRUE","")&IF(A1= "C","TRUE","") etc...

This will work as long as only 1 condition will ever evaluate to TRUE.
Also, the final result will be a text value, but if you need a number you can
enclose the entire thing in a VALUE() function.

Ok, hopefully that all makes sense.

HTH,
Elkar


"Trevor Shuttleworth" wrote:

I don't think you can get past the limitation, unless that's a feature in
Excel 2007

I can't really test this because I don't understand the logic and I don't
have the data. But, splitting it down, you see:

IF(AND(J40=12,J41="YES"),"Multiple",
IF(J39="","",
IF(AND(B48="NO",J40=6),SUM(B39,B41,B43)*3,
IF(B48="YES",SUM(B49:B52,B41,B43,B43,B45),
IF(AND(B46="YES",D54="YES"),(((+B39+B41+B43)*2)+B4 5),
IF(B46="YES",(((+B39+B41+B43)*4)+B45),
IF(D54="YES",(((+B39+B41+B43)*2)+B45),
(((+B39+B41+B43)*4)+B45+B45))))))))

It looks as though two conditions have the same result:

IF(AND(B46="YES",D54="YES"),(((+B39+B41+B43)*2)+B4 5),
IF(D54="YES",(((+B39+B41+B43)*2)+B45),

So, maybe you could combine them, removing one of the IF statements:

IF(OR(AND(B46="YES",D54="YES"),D54="YES"),(((+B39+ B41+B43)*2)+B45),

I think that might mean the B46="YES" test is redundant but I'm not sure.

Anyway, if that works, you can add another IF statement.

I have to be honest and say that I think this will be a nightmare to check
and prove. And, in a few months time you'll probably have no idea what you
were trying to do. More to the point, neither will anyone else.

As an example, you seem to have some repetition of cells:

IF(B48="YES",SUM(B49:B52,B41,B43,B43,B45), 2 x B43
(((+B39+B41+B43)*4)+B45+B45)))))))) 2 x +B45

But, I'm sure you know what you're trying to do ... at least for the moment

Regards

Trevor


"RRDMAT" wrote in message
...
I currently have the following formula in a cell:
IF(AND(J40=12,J41="YES"),"Multiple",IF(J39="","",I F(AND(B48="NO",J40=6),SUM(B39,B41,B43)*3,IF(B48="Y ES",SUM(B49:B52,B41,B43,B43,B45),IF(AND(B46="YES", D54="YES"),(((+B39+B41+B43)*2)+B45),IF(B46="YES",( ((+B39+B41+B43)*4)+B45),IF(D54="YES",(((+B39+B41+B 43)*2)+B45),(((+B39+B41+B43)*4)+B45+B45))))))))

I want to add another condition: IF(AND(J40=4,B48="YES"),(B50+B51)*2)

Any ideas on how to get past the limitation of 7? Maybe a better, more
condensed, way to write the formula?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nested If statements [email protected] Excel Worksheet Functions 3 September 21st 06 10:13 PM
Nested if statements - is there a better way? masterbaker Excel Worksheet Functions 3 July 25th 06 04:59 PM
Nested If Statements Jasmine Excel Worksheet Functions 2 January 26th 06 03:47 PM
what is the max no. of nested Ifs can an If Statements have in EXC StevenE Excel Discussion (Misc queries) 1 June 27th 05 03:03 PM
Do I need nested IF statements? Jaramya Excel Worksheet Functions 1 November 5th 04 09:10 PM


All times are GMT +1. The time now is 09:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"