+ Reply to Thread
Results 1 to 13 of 13

Modify If formula to return N/A if value is Negatitve value

  1. #1
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Modify If formula to return N/A if value is Negatitve value

    Looking to modify the below formula.

    If the value of the formula = negative number return a value of 0

    Please Login or Register  to view this content.
    Last edited by SVTF; 10-26-2014 at 09:27 PM.

  2. #2
    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,946

    Re: Modify If formula to return N/A if value is Negatitve value

    If you want neg either way to show NA, then perhaps this...
    =IF(and(I2="",B2=""),"NA",MAX($B$2,I2)-MIN($B$2,I2))
    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

  3. #3
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Modify If formula to return N/A if value is Negatitve value

    Thanks but the above changed the value from -54 to positive 54

  4. #4
    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,946

    Re: Modify If formula to return N/A if value is Negatitve value

    OK well you have 2 numbers and your formula is swapping them around. Which way round do you wantthe formula to calc?

  5. #5
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Modify If formula to return N/A if value is Negatitve value

    Hmm .. I am going crazy.
    Last edited by SVTF; 10-26-2014 at 08:50 PM.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Modify If formula to return N/A if value is Negatitve value

    that still gives 0 for b2=i2
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  7. #7
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Modify If formula to return N/A if value is Negatitve value

    I think I am on crack tonight. Been trying to get this sheet to work for way to long.

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Modify If formula to return N/A if value is Negatitve value

    another try
    =IF(I2="",IF(B2="","NA",IF($B$2-B2<=0,"na",$B$2-B2)),IF(I2-B2<=0,"na",I2-B2))

  9. #9
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Modify If formula to return N/A if value is Negatitve value

    This formula ... works as needed

    =IF(I2="",IF(B2="","NA",$B$2-B2),I2-B2)

    What I an looking to do is if the result is negative - return 0

  10. #10
    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,946

    Re: Modify If formula to return N/A if value is Negatitve value

    If which 1 returns negative? Because depending on the outcome of the IF's, either 1 could be negative

  11. #11
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Modify If formula to return N/A if value is Negatitve value

    The I2-B2 If statement.

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Modify If formula to return N/A if value is Negatitve value

    put max around it
    max(i2-b2,0)

  13. #13
    Forum Contributor
    Join Date
    08-22-2005
    MS-Off Ver
    Office 365
    Posts
    342

    Re: Modify If formula to return N/A if value is Negatitve value

    @martindwilson - seems to be working as needed ... stay tuned for rep.

+ 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. [SOLVED] Modify macro that matches columns on two different sheets to return entire row of match
    By capson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2014, 02:32 PM
  2. Replies: 8
    Last Post: 05-14-2013, 12:36 AM
  3. [SOLVED] Modify formula to return the highest value
    By score in forum Excel General
    Replies: 2
    Last Post: 12-16-2012, 04:51 PM
  4. How can I modify lzoom to return to previous magnification setting?
    By peterleightonjones in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-22-2011, 11:30 AM
  5. modify look up array to return values across row rather than down column
    By martindwilson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-24-2008, 09:48 AM

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