Simple Logical problem

  • Thread starter Thread starter kknob
  • Start date Start date
K

kknob

Hi I am having a logical problem with If statement....

this is my formula:

=IF(K9=$K$20&$K$20=1, 1, 0)

is there another way of doing this or what is the problem, right now,
the formula always gives 0, even when K9 and K20 = 1..... I don't
know if there is something simple that I am overlooking??

what i want to do is output a 1 when K9 and K20 both equal 1, but not
when they both equal 0.

thanks!!
 
Something like this:

=IF(AND(K9=1,K20=1),1,0)

or even:

=K9*K20

if both cells can only be 1 or 0.

Hope this helps.

Pete
 
=if(and(k9=1,$k$20=1),1,0)
or
=--(and(k9=1,$k$20=1))

The and() returns true or false.

The -- stuff changes the True to 1 and false to 0.
 
If the only options are 1 and 0 for both K9 and K20, use:
=K9 * K20

this formula returns 1 when both the cells are 1, otherwise 0.
 
Hi,

Take
=IF(AND(K9=$K$20,$K$20=1), 1, 0)

or shorter in this special case - if inputs can only be 1 or 0
=--AND(K9,K20)

BTW: The first formula will return 1 only if both K9 and K20 are 1. If
one or both are not equal to 1 it will return 0. The second formula
will return 1 if both inputs are not equal to zero. This irrelevant if
inputs can only be 1 or 0 but think of empty cells or values like3, 4,
or 0.0001.

Regards,
Bernd
 
=IF(AND(K9=$K$20,$K$20=1),1, 0)

=IF(AND(K9=1,$K$20=1),1, 0)

=IF(K9+$K$20=2,1,0)

HTH,
Paul
 
Thanks everyone! I'm using the =K9*K20 formula, that works best since
it can only be 1 or 0. Thanks Pete! So simple it passed right by
me :)
 

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

Back
Top