+ Reply to Thread
Results 1 to 15 of 15

Limit to Whole numbers, no negative #

  1. #1
    Registered User
    Join Date
    04-24-2009
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    6

    Limit to Whole numbers, no negative #

    I have constructed an inventory formula, subtracting Current Inventory (CI) from Required Inventory (RI), to generate a number of how many new products must be Ordered: RI-CI=O. The problem is that if CI exceeds RI, I get a negative number for "O".

    Question: How can I structure the formula to give a zero for any sum less than 1?
    Last edited by oldchippy; 05-01-2009 at 02:36 AM.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Re: Limit to Whole numbers, no negative #

    Hi,

    Welcome to the forum, try something like this

    =IF(B1-A1<0,0,B1-A1)
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    04-24-2009
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Limit to Whole numbers, no negative #

    Hi Oldchippy and thanks for the welcome and suggestion.

    Unfortunately, the function "=IF(K17-J17<0,0,K17-J17)" is classified as "invalid" by Excel's Function Arguments. I have only rudimentary skills with Excel so, if you have any other suggestion or, alterantely, if I made any typo-kind of error(s), I'm all eyes! Thanks in advance!

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Limit to Whole numbers, no negative #

    It's a perfectly valid formula if those two cells contain numbers, not text.
    Entia non sunt multiplicanda sine necessitate

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

    Re: Limit to Whole numbers, no negative #

    or
    =MAX(K17-J17,0)
    "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

  6. #6
    Registered User
    Join Date
    04-24-2009
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Limit to Whole numbers, no negative #

    Sorry folks, I get the same error message using either formula and I double checked both the K17 & J17, as well as the target cell and all are formatted as Number cells with no decimel places. Any other suggestions?

    Thanks again!

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Limit to Whole numbers, no negative #

    Try increasing the decimals by changing the formatting; if they don't change, they're stored as text.

  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: Limit to Whole numbers, no negative #

    attach a workbook with the non working formula leave the = off so it can be added in when we look at it

  9. #9
    Registered User
    Join Date
    04-24-2009
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Limit to Whole numbers, no negative #

    Hello Martin, SHG and Old Chippy,

    Sorry for the delay. As suggested, please find attached a reduced sample of the worksheet I was working on. Your reviewing and modifying to achieve the end I've been seeking is appreciated.
    Attached Files Attached Files

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

    Re: Limit to Whole numbers, no negative #

    well it works for me!
    ive activated the function and am posting back,
    Attached Files Attached Files

  11. #11
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Re: Limit to Whole numbers, no negative #

    Hi,

    Put this in cell C9

    =IF(K9-J9<0,0,K9-J9) then with the cell selected auto-fill downwards to C16 by grabbing the little black square in the bottom right hand corner of the cell. All will be revealed

  12. #12
    Registered User
    Join Date
    04-24-2009
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    6

    Talking Re: Limit to Whole numbers, no negative #

    Hi Martin and Chippy,

    Thank you both very much. As often is the case, the problem was minor: my using a comma instead of a semicolon!

    Martin
    =MAX(K17-J17;0)

    Chippy
    =IF(K10-J10<0;0;K10-J10)

    Is there any advantage of using one formula over the other? Many thanks again!

    kzitil

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

    Re: Limit to Whole numbers, no negative #

    mine has a lower carbon footprint and in the current economic crisis (doh!), it saves on keyboard wear and tear .

  14. #14
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Re: Limit to Whole numbers, no negative #

    Quote Originally Posted by martindwilson View Post
    mine has a lower carbon footprint and in the current economic crisis (doh!), it saves on keyboard wear and tear .
    Nice one Martin

  15. #15
    Registered User
    Join Date
    04-24-2009
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Limit to Whole numbers, no negative #

    Thanks again, Martin & Oldchippy,

    For sharing your wisdom and offering prompt help.

    By the way, I didn't know Carbon has feet. Do other elements as well?

    All the best!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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