IF function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to create an if function that says If cell A, B and C are EACH >=0,
then insert the message "green", if the same three cells are EACH less than 0
then insert the message "red", else insert message "yellow"

Any help would be appreciated!
 
Here you go...assuming the three cells are in A1, B1, and C1:

=IF(AND(A1>=0,B1>=0,C1>=0),"GREEN",IF(AND(A1<0,B1<0,C1<0),"RED","YELLOW"))
 
=IF(COUNTIF(A2:C2,">=0")=3,"green",IF(COUNTIF(A2:C2,"<0")=3,"red","yellow"))

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Bob,
Thanks for the reply. Your solution did not work, but I think only because
the cells were not in a consecutive range. Here's another one I got that did
work:

=IF(AND(A1>=0,B1>=0,C1>=0),"GREEN",IF(AND(A1<0,B1<0,C1<0),"RED","YELLOW"))
Sailor
 
The cells in the one that worked for you are contiguous!

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
I'm sorry Bob, your formula shows the cells as an array. The other one does
not. I probably could have figured our how to change that, however the other
one worked the way it was. Thanks anyway for your help.
Sailor
 
Hi

Bob's solution will work equally as well as your other solution.
I suggest it didn't work because one is looking at A1:C1 and the other at
A2:C2. Given the same ranges you would get the same outcome.

Regards

Roger Govier
 
My apologies to Bob. I was in a hurry and when I tried to change the cell
numbers it didn't work. My mistake. Obviously, I'm not an expert in these
things.
Sailor
 

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