More than one IF Statement

G

Guest

I need a formula that will look at cells k125:k127 and if the cells are "Yes"
then subtract A125 from D23 and so on for K126 and K127. If cells K125:K127
are not "Yes" then subtract A93 from d23. It works if K125 is "Yes", but if
K125:k127 are not "Yes" it returns #Value!, when it should subtract A93 from
D23. Also, if K125 is "Yes", and k126 is "Yes" it returns a -1, when it
should return 0 (d23 will be the same number as K125, k126, and k127, so the
number should be 0).

There probably is an easier formula - Please help.

=IF(K125="Yes",(A125-D23),(A93-D23,IF(K126="Yes",(A126-D23),(A93-D23,IF(K127="Yes",(A127-D23),(A93-D23))))))
 
G

Guest

do you want to subtract D23 from the others or the others from D23? (your
equation and your write-up disagree)
try
=D23-IF(K125="Yes",A125,IF(K126="Yes",A126,IF(K127="Yes",A127,A93)))
 
B

Bob Phillips

is that what you want?

=IF(COUNTIF(K125:K127,"Yes")=3,A125-D23,A93-D23)


--

HTH

RP
(remove nothere from the email address if mailing direct)


heater said:
I need a formula that will look at cells k125:k127 and if the cells are "Yes"
then subtract A125 from D23 and so on for K126 and K127. If cells K125:K127
are not "Yes" then subtract A93 from d23. It works if K125 is "Yes", but if
K125:k127 are not "Yes" it returns #Value!, when it should subtract A93 from
D23. Also, if K125 is "Yes", and k126 is "Yes" it returns a -1, when it
should return 0 (d23 will be the same number as K125, k126, and k127, so the
number should be 0).

There probably is an easier formula - Please help.
=IF(K125="Yes",(A125-D23),(A93-D23,IF(K126="Yes",(A126-D23),(A93-D23,IF(K127
="Yes",(A127-D23),(A93-D23))))))
 
G

Guest

Your formula works when k125 is "yes", however, for some reason when k126 is
"yes" the result is 1. If k126 is "yes" then D23 will equal the same number
as k126; therefore the result should be 0. The same thing happens when K127
equals "yes", the result is 2. However, d23 equals k127, so it should be 0.
 
G

Guest

Not really. You only reference if k125 is "Yes" then A125-d23. What if K126
and/or k127 is "Yes". I need it to subtract D23 from K126 and D23 from k127
if they are "Yes".
 
B

Bob Phillips

How can you subtract from a string value.

How about some examples for each situation?

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top