Mike U
Mike U

Reputation: 79

Nested IF Formula

I want to perform a calculation, in column D of a spreadsheet, that depends on a string in column K. The calculations required are, if column K says:

 "Income then Principal ", then perform: (E2 + F2) - H2  
 "50 50 ",                 then perform: ((H2/2) - E2))+((H2/2) - F2))  
 "100% Principal ",        then perform: F2 - H2  
 "100% Income ",           then return:  $0.00

I wrote the nested IF formula shown below. It works for "Income then Principal" and "100% Income", but I get a return of FALSE for "50 50 " and a #VALUE! error for "100% Principal ". I think I have a syntax error in my formula but I'm having trouble isolating it.

=IF(K3="Income then Principal ",(E3+F3)-H3,IF(K3="100% Principal ",F2-H2,IF(K3="50 50",((H2/2)-E2+(H2/2)-F2),IF(K3="100% Income ",))))

Upvotes: 0

Views: 184

Answers (2)

pnuts
pnuts

Reputation: 59485

Numbering the options (say 1 to 4 in ColumnM in order as above) would allow at least a much shorter formula:

=CHOOSE(M3,E3+F3-H3,H3-E3-F3,F3-H3,0)

(The above might not have all the + and - in the right places! but troubleshooting is should be easy.)

Upvotes: 1

John Bustos
John Bustos

Reputation: 19574

This seemed to work for me:

=IF(K3="Income then Principal ",(E3+F3)-H3,IF(K3="100% Principal ",F2-H2,IF(K3="50 50 ",((H2/2)-E2+(H2/2)-F2),IF(K3="100% Income ",0,))))

Upvotes: 0

Related Questions