0

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 ",))))
3
  • Your last if() is incomplete - IF(K3="100% Income ",) May 22, 2013 at 16:13
  • 1
    confirm the trailing spaces in your formula match the cell values in K3, e.g., "50 50 " vs. "50 50"? May 22, 2013 at 16:18
  • 1
    Nested ifs can get complicated quickly: you can sometimes simplify this a bit by using something along the lines of =CHOOSE(MATCH(K1,{"A","B","C"}),"Value if A","Value if B", "Value if C") May 22, 2013 at 16:46

2 Answers 2

1

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.)

0

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,))))
1
  • This worked - =IF(K3="Income then Principal ",(E3+F3)-H3,IF(K3="100% Principal ",F3-H3,IF(K3="50 50 ",((H3/2)-E3+(H3/2)-F3),IF(K3="100% Income ",)))) @pnuts good point about referencing row2 and row3 simultaneously, row2 is my header row so that was an error on my end. Writing this out really helped.
    – Mike U
    May 22, 2013 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.