Too many nested Ifs

chicosbailbonds

New Member
Joined
Dec 18, 2009
Messages
44
Can anyone figure out a way to shorten the amount of ifs in this formula? I'm using excel 2003 and running into the nested if issue. It basically looks to see if the value in C is Positive, negative, or zero. If it is zero it checks to see if column R & S Are also zero if they are it prints N/A if not it should take the sum of R&S divided by the sumif of what is on the MTD sheet... if the explanation will help I can go further but I don't think my explaining the formula will help. I've been banging my head on the desk all afternoon I would prefer to not have to add additional columns to split this out because I do it 4 times. Thanks in advance for your help.
=IF($C22=0,(R22+S22)/SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B22,'MTD- LP'!$J:$J),IF(($C22=0)*(R22=0)*(S22=0)),"N/A",IF($C22>0,IF(ISERROR((R22+S22)/SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B22,'MTD- LP'!$J:$J)),(R22+S22)/SUMIF('Current- LP'!$A:$A,'Positions-LP'!$B22,'Current- LP'!$I:$I),(R22+S22)/SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B22,'MTD- LP'!$J:$J)),IF(ISERROR((R22+S22)/SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B22,'MTD- LP'!$J:$J)),(R22+S22)/-SUMIF('Current- LP'!$A:$A,'Positions-LP'!$B22,'Current- LP'!$I:$I),(R22+S22)/-SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B22,'MTD- LP'!$J:$J)))))
 
Last edited:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Solved after taking a few minutes away from the issue.

=IF(($C23=0)*(R23=0)*(S23=0),"N/A",IF($C23=0,(R23+S23)/SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B23,'MTD- LP'!$J:$J),IF($C23>0,IF(ISERROR((R23+S23)/SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B23,'MTD- LP'!$J:$J)),(R23+S23)/SUMIF('Current- LP'!$A:$A,'Positions-LP'!$B23,'Current- LP'!$I:$I),(R23+S23)/SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B23,'MTD- LP'!$J:$J)),IF(ISERROR((R23+S23)/SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B23,'MTD- LP'!$J:$J)),(R23+S23)/-SUMIF('Current- LP'!$A:$A,'Positions-LP'!$B23,'Current- LP'!$I:$I),(R23+S23)/-SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B23,'MTD- LP'!$J:$J)))))
 
Upvote 0
Hello and welcome to MrExcel, try like this

=IF($C22=0,IF((R22=0)*(S22=0),"N/A",(R22+S22)/SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B22,'MTD- LP'!$J:$J)),SIGN($C22)*IF(ISERROR((R22+S22)/SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B22,'MTD- LP'!$J:$J)),(R22+S22)/SUMIF('Current- LP'!$A:$A,'Positions-LP'!$B22,'Current- LP'!$I:$I),(R22+S22)/SUMIF('MTD- LP'!$A:$A,'Positions-LP'!$B22,'MTD- LP'!$J:$J)))
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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