Assing a value to a cell conditional on another.

G

guilbj2

I'm trying to assign a value to a cell conditionally dependant o
another cells value. Something like...

=IF(K21=55,P21=27)

I get "FALSE" as the result. Can anyone help me with the flaw in m
formula
 
A

Allan S. Warrior

I'm assuming this formula is in P21. If so, it should read
=IF(K21=55, 27,)
 
C

Cutter

You told Excel to make the value in cell P21 equal 27 IF the value in
cell K21 equals 55.

You haven't told Excel what to put in cell P21 if K21 does not equal
55.

Your formula should be (in P21) this:
=IF(K21=55,27,0)

Change the zero in the formula to whatever you want P21 to be if K21
does not equal 55
 
H

Hari

Hi Guil,

Where are u putting this formula?

If ur putting this in P21 then the syntax should be
If(Logical_test,value_if_true,value_if_false). Note value_if_true and
Value_if_false mean that u shud just put the values not the cell addresses.

If ur putting this in a cell other than P21 then AFAIK it will evaluate to
FALSE always (Unless P21 already had 27 as value) To better understand it u
might use Tools, Show formula auditing toolbar and then evaluate formula.
This will give u step by step evaluation. For example suppose in cell D22 I
write the formula =IF(D21="",E20=4,G20=5) where D21, E20 and G20 are all
empty cells then formula will evaluate to false.But suppose E20 and G20
already had the values 4 and 5 respectively then it will evaluate as False.

Regards,
Hari
India
 
H

Hari

Hi,
A correction..

"But suppose E20 and G20 already had the values 4 and 5 respectively then it
will evaluate as True"

Regards,
Hari
India

Hari said:
Hi Guil,

Where are u putting this formula?

If ur putting this in P21 then the syntax should be
If(Logical_test,value_if_true,value_if_false). Note value_if_true and
Value_if_false mean that u shud just put the values not the cell addresses.

If ur putting this in a cell other than P21 then AFAIK it will evaluate to
FALSE always (Unless P21 already had 27 as value) To better understand it u
might use Tools, Show formula auditing toolbar and then evaluate formula.
This will give u step by step evaluation. For example suppose in cell D22 I
write the formula =IF(D21="",E20=4,G20=5) where D21, E20 and G20 are all
empty cells then formula will evaluate to false.But suppose E20 and G20
already had the values 4 and 5 respectively then it will evaluate as False.

Regards,
Hari
India
 
Top