conditions in Excel

  • Thread starter Thread starter farsta_online
  • Start date Start date
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
 
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?
 
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
 
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
 
Oki, I see how you mean. But I´m looking for the principle to write
multiple conditions
/Peter
 
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
 
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
 
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
 

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