+ Reply to Thread
Results 1 to 19 of 19

Conditional Statement for Negative Numbers inside a Conditional Formula

  1. #1
    Registered User
    Join Date
    12-18-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    15

    Conditional Statement for Negative Numbers inside a Conditional Formula

    Hi, I'm not great at Excel and I need a way to use negative numbers in calculations as zero.

    Here's my whole formula:
    Please Login or Register  to view this content.
    If the value for Calculator!$E10 is a negative number I need it to calculate as 0.

    My gut wants to do something like this:
    Please Login or Register  to view this content.
    But the negatives are reporting out as positive (ie, 1 - -1 = 2) when the answer should be 1.

    Help?
    Last edited by kuzniak; 12-18-2015 at 04:41 PM.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    If the value for Calculator!$E11 is a negative number I need it to calculate as 0.
    The only place I see E11 in your post is in the line I quoted.
    I don't see it in your formulas.

  3. #3
    Registered User
    Join Date
    12-18-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    15

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Sorry E10. I edited my post to reflect.

  4. #4
    Registered User
    Join Date
    12-18-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    15

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Sorry, E10. I edited my post to reflect.

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,970

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    If you have a subtraction which can be negative you can replace:

    Calculator!F10-Calculator!$E10 with: (MAX(0,Calculator!F10-Calculator!$E10))
    Last edited by protonLeah; 12-18-2015 at 05:07 PM.
    Ben Van Johnson

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    How about substituting this into your formula.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-18-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    15

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Ah, when I make the substitution the resultant is #NAME?
    ???

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Can you post your formula as you have it entered (copy and paste here)?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  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
    53,050

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Can you show how you substituted?
    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

  10. #10
    Registered User
    Join Date
    12-18-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    15

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Quote Originally Posted by protonLeah View Post
    If you have a subtraction which can be negative you can replace:

    Calculator!F10-Calculator!$E10 with: (MAX(O,Calculator!F10-Calculator!$E10))
    If I make the substitution I get #NAME?
    If the O is supposed to be a 0 then it calculates like this: 1- -1=2 when I want this: 1- -1=1

  11. #11
    Registered User
    Join Date
    12-18-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    15

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Quote Originally Posted by ChemistB View Post
    Can you post your formula as you have it entered (copy and paste here)?
    This is what I have:
    =IF(((Calculator!F10-Calculator!$E10)*Calculator!F$5/Calculator!F$4)>$D5,(Calculator!F10-Calculator!$E10)*Calculator!F$5/Calculator!F$4,"dl")

    I need the Calculator!$E10 value to be recognized as 0 if it is a negative number.

  12. #12
    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
    53,050

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    =IF(((Calculator!F10-max(0,Calculator!$E10))*Calculator!F$5/Calculator!F$4)>$D5,(Calculator!F10-max(0,Calculator!$E10))*Calculator!F$5/Calculator!F$4,"dl")

  13. #13
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,970

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Sorry, that was supposed to be zero not O:
    Please Login or Register  to view this content.
    if the remainder from the subtraction is negative.

  14. #14
    Registered User
    Join Date
    12-18-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    15

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Quote Originally Posted by FDibbins View Post
    =IF(((Calculator!F10-max(0,Calculator!$E10))*Calculator!F$5/Calculator!F$4)>$D5,(Calculator!F10-max(0,Calculator!$E10))*Calculator!F$5/Calculator!F$4,"dl")
    Thank you, however your formula changes the negative into a positive and subtracts such as: 1 - -1=0
    I need 1 - -1=1

  15. #15
    Registered User
    Join Date
    12-18-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    15

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Quote Originally Posted by kuzniak View Post
    Thank you, however your formula changes the negative into a positive and subtracts such as: 1 - -1=0
    I need 1 - -1=1
    Wait! I found my mistake!
    I have no idea how this works but thank you this did it!

  16. #16
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    1- -1 = 2
    in most states.

  17. #17
    Registered User
    Join Date
    12-18-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    15

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Anyways thanks everyone!

  18. #18
    Registered User
    Join Date
    12-18-2015
    Location
    Minnesota
    MS-Off Ver
    2007
    Posts
    15

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Quote Originally Posted by ChemistB View Post
    1- -1 = 2
    in most states.
    Not when -1 represents an illogical number.

  19. #19
    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
    53,050

    Re: Conditional Statement for Negative Numbers inside a Conditional Formula

    Happy to help, and thanks for the feedback

    It is based on 0 being > any negative, and any positive being > 0...
    Calculator!F10-max(0,Calculator!$E10)
    So F10-(whichever is greater, 0 or E120)

+ 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. Conditional formatting inside a formula
    By algl05ab in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-10-2014, 11:26 AM
  2. How to make conditional formatting for negative numbers?
    By ks100 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-19-2014, 01:06 PM
  3. [SOLVED] Formula inside a conditional format
    By Tritekfire in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-15-2013, 11:49 AM
  4. Conditional formatting for positive/negative numbers
    By amartino44 in forum Excel General
    Replies: 5
    Last Post: 04-24-2013, 07:17 PM
  5. Conditional Statement for 4 Positive or Negative #'s in row
    By lsu0358 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-05-2009, 11:07 AM
  6. adding conditional inside formula...
    By lespaul42 in forum Excel General
    Replies: 1
    Last Post: 02-28-2009, 01:25 PM
  7. Replies: 3
    Last Post: 08-25-2005, 03:05 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