ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Simple Logical problem (https://www.excelbanter.com/excel-discussion-misc-queries/175500-simple-logical-problem.html)

kknob

Simple Logical problem
 
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!!

Pete_UK

Simple Logical problem
 
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

On Feb 4, 5:19*pm, kknob wrote:
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!!



Dave Peterson

Simple Logical problem
 
=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.



kknob wrote:

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


--

Dave Peterson

Gary''s Student

Simple Logical problem
 
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.
--
Gary''s Student - gsnu2007d

Bernd P

Simple Logical problem
 
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

PCLIVE

Simple Logical problem
 


=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


--

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




kknob

Simple Logical problem
 
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 :)

Pete_UK

Simple Logical problem
 
You're welcome - looks like it passed right by the others, too !! <bg

Pete

On Feb 4, 5:45*pm, kknob wrote:
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 :)




All times are GMT +1. The time now is 11:54 PM.

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