ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   More than one IF Statement (https://www.excelbanter.com/excel-discussion-misc-queries/41666-more-than-one-if-statement.html)

heater

More than one IF Statement
 
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))))))

bj

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

"heater" wrote:

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


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" wrote in message
...
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))))))



heater

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.

"bj" wrote:

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

"heater" wrote:

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


heater

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

"Bob Phillips" wrote:

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" wrote in message
...
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))))))




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)


"heater" wrote in message
...
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".

"Bob Phillips" wrote:

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" wrote in message
...
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))))))







All times are GMT +1. The time now is 01:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com