conditions in Excel

F

farsta_online

Hi,
I need help with conditions:

How do I write the content of cell B9:
1)A2>0 AND B2>0
if true: B9 = c
if False: B9 = d

2) A2>0 or B2>0
if true: B9 = e
if False: B9 = f

3) A2 = g AND B2 = h AND C2 = i
if true: B9 = j
if False: B9 = k

4) A2 = l OR B2 = m OR C2 = n
if true: B9 = o
if False: B9 = p

Any answer willbe appriceated
Peter
 
F

Frank Kabel

Hi
some questions:
- do you want a worksheet formula or a VBA solution?
- your first and second condition are identical but you want different
results?
 
P

Peter L

Hi Frank and thanks for your answer
If it not too mutch trubble I would like to have both a worksheet
formula or a VBA solution?

In your answer you wrote that:"your first and second condition are
identical but you want different
results?" They aren´t identical, in #1 both conditions have to been met
and in #2 either of the conditionx

Regards
Peter




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
F

Frank Kabel

Hi
sorry for not reading carefully enough (too early in the morning).
Though there's still a problem:
Assume the first condition is not met (e.g. only A2>0) then you say you
want the 'False' result of 'd'. BUT your second condition in this case
is also met and this would require 'e'. So what is for example your
expected result for:
A2 = 2
B2 = -1
 
P

Peter L

OK, it´s maybee easier if I give a real life example:
D8 = 100 AND 1.5 < D6/D8 < 25
IF True: D8 = 100
else D8 = 250 AND 1.5 < D6/D8 < 25
If True: D8 = 250
else
D8 = 500 AND 1.5 < D6/D8 < 25
If TrueD8 = 500

Do you see what I´m trying to do?
/Peter




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
F

Frank Kabel

Hi
you could always used nested IF conditions. To give you an example
=IF(AND(A1>0,B1>0),"A1+B1 >0",IF(OR(A1>0,B1>0),"A1 or B1 are >0","None
is greater than zero"))

Note: The maximum are 7 nested function calls
 
N

NickHK

Peter,
D8 cannot hold a value and also the result of a comparison. It's one or the
other. You logic is not sensible as you wish to change the value that you
are using in the comparison to what it would have to be true anyway.

In terms of multiple condition, something this formula in D9 may be what you
want:
=IF(AND(D6/D8>1.5,D6/D8<25),D8,FALSE)

NickHK
 
Top