Conditional If Statements

  • Thread starter Thread starter jesoldano
  • Start date Start date
J

jesoldano

Hello--I am a novice with respect to conditional if statements. I
would like to express the following in a formula:

If cell A >=5 AND cell B>2, return Red
If cell A<=5 AND cell B=0, return Green
If cell A>=5 AND cell B=0 OR Cell A<=5 AND cell B=2-5, Return Yellow.

I know this is a lot. What I would like to know is whether it is even
possible to include this many conditions.

Thanks!
 
Hi,

You can have these many conditions.

=IF(AND(A1>=5,B1>2),"RED",IF(AND(A1<=5,B1=0),"GREEN",IF(AND(OR(AND(A1>=5,B1=0),A1<=5),B1<=5),"YELLOW",""))

You may need to twick this as I have not completely tested this. It would
have been a lot easier with some sample data.
HTH,
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think a post is useful, please rate it as an ANSWER, it will help
others!!
 
Hi,

You can have these many conditions.

=IF(AND(A1>=5,B1>2),"RED",IF(AND(A1<=5,B1=0),"GREEN",IF(AND(OR(AND(A1>=5,B1­=0),A1<=5),B1<=5),"YELLOW",""))

You may need to twick this as I have not completely tested this. It would
have been a lot easier with some sample data.
HTH,
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think a post is useful, please rate it as an ANSWER, it will help
others!!








- Show quoted text -

Hello--thanks so much for your help. I know it would be easier for me
to provide data, but unfortunately the data is confidential. The
formula you provided is working, but is only returing
"Yellow" (although I know that there should be a few reds and greens
as well). Any idea of why this may be?
 
Hi,

You can have these many conditions.

=IF(AND(A1>=5,B1>2),"RED",IF(AND(A1<=5,B1=0),"GREEN",IF(AND(OR(AND(A1>=5,B1­=0),A1<=5),B1<=5),"YELLOW",""))

You may need to twick this as I have not completely tested this. It would
have been a lot easier with some sample data.
HTH,
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think a post is useful, please rate it as an ANSWER, it will help
others!!








- Show quoted text -

Nevermind--I just fixed it! Thanks everyone for the help.
 

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