I have question. I have a formula for i.e. =SUM(A2*C3-B3) now I want to enter 0 in the cell if the answer to the sum is less than 0.
I have tried a few ways but nothing works, like =if(sum(A2*C3-B3)<0,sum(A2*C3-B3),"")
Any idea's?
I have question. I have a formula for i.e. =SUM(A2*C3-B3) now I want to enter 0 in the cell if the answer to the sum is less than 0.
I have tried a few ways but nothing works, like =if(sum(A2*C3-B3)<0,sum(A2*C3-B3),"")
Any idea's?
=MAX( SUM(), 0)
MAX will return the largest of the array of input values. Since 0 is larger than negative numbers, the MAX will return zero when SUM returns negative.
EDIT:
Also
=SUM(A2*C3-B3)
is going to assess that math FIRST, to get
intermediate = A2*C3-B3
and save that in RAM, and then it will run
=SUM(intermediate)
which is going to return the SUM of one term in the list.
So, in short,
=SUM(A2*C3-B3) = A2*C3-B3
except that one on the right will be easier to read!
So really all you need is, based on this example,
=MAX(A2*C3-B3, 0)
Last edited by ben_hensel; 11-19-2013 at 06:15 AM. Reason: caveat on syntax
Thanks Ben, works a treat. Iam just a novice at this so much appreciated.
Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
Thanks.
Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
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
Ok thanks for th headsup
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks