Excel quick question

importdistributors

Senior member
Sep 14, 2004
294
0
0
Hello, I have a quick question for anyone who has knowledge in excel/vba. I need to make a cells results stay positive or zero, If the cell comes up to be a negative number, I want it to automatically say zero. Thanks in advance.
 

AtlantaBob

Golden Member
Jun 16, 2004
1,034
0
0
=if(val<0,0,val) should do the trick....
that is, if val <0, then cell = 0; otherwise, it's equal to the value entered.
 

TuxDave

Lifer
Oct 8, 2002
10,571
3
71
Example:
=MAX(A4,0)

Basically this will display the higher of the two numbers. The number in cell A4 and 0.
 

AtlantaBob

Golden Member
Jun 16, 2004
1,034
0
0
Nope, you'd have to use either the IF() method or Dave's MAX() method; however, if you're using this for multiple cells, enter the format in the first one and then use fill down, or fill right and it'll automatically adjust the input values for you.