+ Reply to Thread
Results 1 to 8 of 8

Converting A Negative Value Cell to Zero Automatically

Hybrid View

  1. #1
    Registered User
    Join Date
    11-30-2008
    Location
    Mumbai
    Posts
    25

    Converting A Negative Value Cell to Zero Automatically

    Hello again,

    I needed help on negative value cells.

    I want to automatically convert a negative value cell to zero (0) if positive, want to calculate 12.5% of its value.

    I am attaching a sheet. In this sheet if B2 is greater then C2 (profit) then D2 should automatically 12.5% of it. But if B2 is less than C2 (loss) then the cell should automatically be zero (0).

    Can someone help me with this problem.
    Attached Files Attached Files
    Last edited by striker_rage; 07-25-2010 at 11:17 AM.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Converting A Negative Value Cell to Zero Automatically

    Put this formula in D2:

    =IF(B2>C2,B2*0.125,0)

  3. #3
    Registered User
    Join Date
    11-30-2008
    Location
    Mumbai
    Posts
    25

    Re: Converting A Negative Value Cell to Zero Automatically

    Thanks a lot Andrew....this is exactly what i was looking for.

    Can you help me again on this one.

    Now the alignment is different but i want the exact same thing.

    I am attaching a new excel sheet with the new alignment. Can you do the same magic on this one too.

    I want all of the profits added and minus all the loss and loss from previous year. Then if the total come positive, 12.5% on that or else if negative then the cell should display zero (0).

    Thanks a lot again for the help.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Converting A Negative Value Cell to Zero Automatically

    Yes I can, but only if the format is not going to change (i.e. two rows of profit, two rows of loss and one row of previous year loss). If you try to insert or delete rows then a simple formula wouldn't work.

    If you really do want just that format then the formula would be:

    =IF(SUM(C2:C3)-SUM(C4:C6)>0,(SUM(C2:C3)-SUM(C4:C6))*0.125,0)

    That works out 12.5% of the difference between profit and loss (if it's positive), while the previous formula works out 12.5% of the profit, by the way - I wasn't sure which one you wanted.

    The easiest way to do it would be to represent the profits as positive numbers and the loses as negative, then you could use the easier formula:

    =IF(SUM(C2:C6)>0,SUM(C2:C6)*0.125,0)

    Alternatively, if you just labelled column B "Profit" or "Loss" you could use a SUMIF formula:

    =IF(SUMIF(B2:B6,"=Profit",C2:C6)-SUMIF(B2:B6,"=Loss",C2:C6)>0,(SUMIF(B2:B6,"=Profit",C2:C6)-SUMIF(B2:B6,"=Loss",C2:C6))*0.125,0)

  5. #5
    Registered User
    Join Date
    11-30-2008
    Location
    Mumbai
    Posts
    25

    Re: Converting A Negative Value Cell to Zero Automatically

    Thanks a lot Andrew,

    I wanted the formula to add all the profits and then minus all the losses and if its positive then calculate 12.5% on that.

    If it turns out negative then the cell should display zero (0).

    I pasted the formula that you gave and it works fantastic.

    Thanks you so much for helping me out on this. I am really grateful.


    Mods can close this topic as solved.
    Last edited by striker_rage; 07-25-2010 at 10:00 AM. Reason: Solved

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Converting A Negative Value Cell to Zero Automatically

    Don't report posts because they are solved

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    11-30-2008
    Location
    Mumbai
    Posts
    25

    Re: Converting A Negative Value Cell to Zero Automatically

    Quote Originally Posted by royUK View Post
    Don't report posts because they are solved

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Thank you Roy for the heads up. Will remember and do this next time. Sorry for the trouble.

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

    Re: Converting A Negative Value Cell to Zero Automatically

    Will remember and do this next time.
    How about doing it this time?
    Entia non sunt multiplicanda sine necessitate

+ 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