+ Reply to Thread
Results 1 to 10 of 10

IF Function with negatives

  1. #1
    Registered User
    Join Date
    05-27-2018
    Location
    USA
    MS-Off Ver
    2016
    Posts
    4

    IF Function with negatives

    I want to create the labels of "green","yellow", or "red" depending on the value found in a certain cell.

    -5000 -> 0 & 0 -> 5000 are green
    -50000 -> -5000 & 5000 ->50000 are yellow
    anything lower than -50000 & anything higher than 50000 is red

    the current formula I have is this :

    =IF(I9<"-50000","red",IF(I9>="-50000","yellow",IF(I9>"-15000",IF(I9<=15000,"green",IF(I9<=50000,"yellow",IF(I9>50000,"red"))))))

    I keep getting everything as red whenever I include the negative numbers. Please help!

  2. #2
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: IF Function with negatives

    Don't surround numbers, even when they are negative, with quotes.

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF Function with negatives

    I wonder if this might work for you...
    =IF(ABS(I9)<=5000,"green",IF(ABS(I9)<=50000,"yellow","red"))
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Registered User
    Join Date
    05-27-2018
    Location
    USA
    MS-Off Ver
    2016
    Posts
    4

    Re: IF Function with negatives

    That did work a bit, but then green never appears.

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF Function with negatives

    which post are you referring to?

  6. #6
    Registered User
    Join Date
    05-27-2018
    Location
    USA
    MS-Off Ver
    2016
    Posts
    4

    Re: IF Function with negatives

    You are amazing! Thanks!

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: IF Function with negatives

    maybe this?

    =IF(ABS(I9)>50000,"red",IF(ABS(I9)>5000,"yellow","green"))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  8. #8
    Registered User
    Join Date
    05-27-2018
    Location
    USA
    MS-Off Ver
    2016
    Posts
    4

    Re: IF Function with negatives

    Quote Originally Posted by Sambo kid View Post
    which post are you referring to?
    Sorry, you were right. Thanks!

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: IF Function with negatives

    If this answered your question, please take a moment to mark the thread as "solved" - it helps keep things neat and tidy lol, and consider adding the reputation to those that helped (see points 2 & 3 below my 1st post to you)

  10. #10
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF Function with negatives

    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Getting negatives (-1) in the out put
    By kasi.maddula in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-30-2014, 06:21 AM
  2. [SOLVED] Best Chart for mix of positives and negatives
    By Eric S in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 03-22-2013, 10:37 PM
  3. Sum Negatives into next Positive
    By ScooterNM5 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 11-05-2010, 07:01 AM
  4. formula to allow only negatives
    By Jack 42 in forum Excel General
    Replies: 8
    Last Post: 05-04-2007, 01:58 PM
  5. Negatives to Positives, Positives to Negatives
    By Virginia Woolf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-01-2007, 08:59 PM
  6. [SOLVED] Positives and Negatives
    By Niagera College Student in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-20-2005, 06:05 PM
  7. multiply negatives
    By Penny in forum Excel General
    Replies: 6
    Last Post: 03-22-2005, 08:08 PM
  8. [SOLVED] No negatives
    By PCOR in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2005, 03:06 PM

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