IF, AND

I

Ibrahim Awwad

Dear All,

I'm trying to use theIF function as following =IF(And
(y=0,z=0),x,z), but the -AND- logical test isn't working. The formula part of
the true value is implemented even if the y=0 or z=0 not both of them.

Is there any help.
--
*********
IT Manager
DeLaval Ltd.
Cairo-Egypt
*********
|-----------------------------|
|Islam is peace not Terror|
|-----------------------------|
 
S

Springbok

Hi,
Not sure if the problem lies in the format of the numbers (i.e. text)? Have
you tested it?
Cheers,
Jon
 
I

Ibrahim Awwad

Hi Yes i tested the following exactly:
=IF(AND($A$11=0,B4=0),"",(D4-$A$11)/$A$11)

But now the formula part [(D4-$A$11)/$A$11] works even if only one of the
two conditions [($A$11=0,B4=0)] is true. I think the folrmula shouldn't work
until the both conditions after AND are true.
 
B

Bob Phillips

Also, are y and z named ranges or are you really using cell references?

--

HTH

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

Bob Phillips

Your reasoning is correct. Whilst the cells A11 and B4 look empty, are you
sure that they do not contain spaces(s). Do a =LEN(A11) and =LEN(B4)
somewhere, if they are not both 0, that is the problem.

Your formula also has a problem if B4 is not 0, but a11 is, as it returns a
#DIV/0! error (dividing by 0 - A11).

--

HTH

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


Ibrahim Awwad said:
Hi Yes i tested the following exactly:
=IF(AND($A$11=0,B4=0),"",(D4-$A$11)/$A$11)

But now the formula part [(D4-$A$11)/$A$11] works even if only one of the
two conditions [($A$11=0,B4=0)] is true. I think the folrmula shouldn't work
until the both conditions after AND are true.

Springbok said:
Hi,
Not sure if the problem lies in the format of the numbers (i.e. text)? Have
you tested it?
Cheers,
Jon
 
N

nbrcrunch

Your formula

=IF(And(y=0,z=0),x,z)

will not work unless you are working with named ranges. (Y & Z are
unsafe named ranges because there is the danger of it being
interpretted as the whole columns of Y or Z.)

Using cell references:

=IF(And(B2=0,C2=0),B2,C2)

In the above, if both B2 and C2 equal zero, then the answer will be
zero. If both are not zero, the answer will be whatever is in cell C2.
However, if B2=2 and C2=0, your answer will be zero, making it appear
that no matter what, your answer is zero.
 

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

Similar Threads

Out of office assistant 1
E-Mail Search isn't working 0
Mail headers and details 5
Tasks not displayed 3
Sent mails format 7
Field Customization 1
Can't specify Pages for print out 1
Recover Deleted Items in 2007 5

Top