Excel question about negative value

Psyber

Senior member
Oct 27, 1999
677
0
0
How do I create a cell where if the value calculated is less than or equal to 0, then it outputs 0. If the value calculated is positive it outputs the postive number. I'm hoping I don't have to use the if, then statement. It gets kinda hairy because of cell references.

Thanks in advance,
Psyber
 

BlueWeasel

Lifer
Jun 2, 2000
15,944
475
126
An If-then statement would most certainly do it, but you might could use SIGN function...

Assume you have a value of 10 in cell A1. Using SIGN(A1) will return a value of 1. Changing A1 to equal 0 will return a value of 0, and changing A1 to equal -10 will return a value of -1.

You could just simply multiply the value of A1 and the return to get the positive number. If it's zero, then that would also work as well. Unfortunately, the wrinkle comes in about getting the negative number to also return zero without using an If-then statement.
 

kranky

Elite Member
Oct 9, 1999
21,019
156
106
Use:

MAX(<formula>, 0)

where <formula> is whatever calculations you want to use.
 

Psyber

Senior member
Oct 27, 1999
677
0
0
Thanks to both of you for your help. I decided to use MAX(<formula>, 0).