+ Reply to Thread
Results 1 to 9 of 9

IF function

Hybrid View

  1. #1
    Sailor
    Guest

    IF function

    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!

  2. #2
    Forum Contributor Lotus123's Avatar
    Join Date
    11-07-2005
    Location
    Texas
    MS-Off Ver
    2007
    Posts
    153
    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"))

  3. #3
    Sailor
    Guest

    Re: IF function

    Lotus123,
    You're a peach! This worked beautifully, thanks.
    Sailor

    "Lotus123" wrote:

    >
    > 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"))
    >
    >
    > --
    > Lotus123
    > ------------------------------------------------------------------------
    > Lotus123's Profile: http://www.excelforum.com/member.php...o&userid=28611
    > View this thread: http://www.excelforum.com/showthread...hreadid=487001
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: IF function

    =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)


    "Sailor" <[email protected]> wrote in message
    news:[email protected]...
    > 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!




  5. #5
    Sailor
    Guest

    Re: IF function

    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

    "Bob Phillips" wrote:

    > =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)
    >
    >
    > "Sailor" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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!

    >
    >
    >


  6. #6
    Bob Phillips
    Guest

    Re: IF function

    The cells in the one that worked for you are contiguous!

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Sailor" <[email protected]> wrote in message
    news:[email protected]...
    > 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
    >
    > "Bob Phillips" wrote:
    >
    > >

    =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)
    > >
    > >
    > > "Sailor" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > 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!

    > >
    > >
    > >




  7. #7
    Sailor
    Guest

    Re: IF function

    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

    "Bob Phillips" wrote:

    > The cells in the one that worked for you are contiguous!
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Sailor" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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
    > >
    > > "Bob Phillips" wrote:
    > >
    > > >

    > =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)
    > > >
    > > >
    > > > "Sailor" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > 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!
    > > >
    > > >
    > > >

    >
    >
    >


  8. #8
    Roger Govier
    Guest

    Re: IF function

    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


    Sailor wrote:
    > 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
    >
    > "Bob Phillips" wrote:
    >
    >
    >>The cells in the one that worked for you are contiguous!
    >>
    >>--
    >>
    >>HTH
    >>
    >>RP
    >>(remove nothere from the email address if mailing direct)
    >>
    >>
    >>"Sailor" <[email protected]> wrote in message
    >>news:[email protected]...
    >>
    >>>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
    >>>
    >>>"Bob Phillips" wrote:
    >>>
    >>>

    >>=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)
    >>>>
    >>>>
    >>>>"Sailor" <[email protected]> wrote in message
    >>>>news:[email protected]...
    >>>>
    >>>>>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!
    >>>>
    >>>>
    >>>>

    >>
    >>


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1