ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Returning zero if the results of a formula is a negative number? (https://www.excelbanter.com/excel-discussion-misc-queries/184444-returning-zero-if-results-formula-negative-number.html)

James23

Returning zero if the results of a formula is a negative number?
 
How do I get a simple addition formula to return a zero in a cell if the
formula yields a negative number?

Gary''s Student

Returning zero if the results of a formula is a negative number?
 
=IF(A1+A2<0,0,A1+A2)
--
Gary''s Student - gsnu200780


"James23" wrote:

How do I get a simple addition formula to return a zero in a cell if the
formula yields a negative number?


Dave Peterson

Returning zero if the results of a formula is a negative number?
 
=max(0,yourformula)



James23 wrote:

How do I get a simple addition formula to return a zero in a cell if the
formula yields a negative number?


--

Dave Peterson

James23

Returning zero if the results of a formula is a negative numbe
 
Bingo, thanks. Works perfect.

This is how my cell looks after your advice.

=IF((N31-(K31+L31+M31)-40)<0,0,(N31-(K31+L31+M31)-40))

As with any aspect of Excel, I'm sure there is a better way to do this, but
this is the best that I can come up with.

Thanks again.

"Gary''s Student" wrote:

=IF(A1+A2<0,0,A1+A2)
--
Gary''s Student - gsnu200780


"James23" wrote:

How do I get a simple addition formula to return a zero in a cell if the
formula yields a negative number?


James23

Returning zero if the results of a formula is a negative numbe
 
Thanks Dave.

That works very well too.



"Dave Peterson" wrote:

=max(0,yourformula)



James23 wrote:

How do I get a simple addition formula to return a zero in a cell if the
formula yields a negative number?


--

Dave Peterson


James23

Returning zero if the results of a formula is a negative numbe
 
This is my cell:

=MAX(0,((N29-(K29+L29+M29)-40)))

"Dave Peterson" wrote:

=max(0,yourformula)



James23 wrote:

How do I get a simple addition formula to return a zero in a cell if the
formula yields a negative number?


--

Dave Peterson


dlw

Returning zero if the results of a formula is a negative numbe
 
You don't need all the parens, unless it helps with understanding the
formula, when adding and subtracting, it doesn't matter the order in which
you do it.

"James23" wrote:

This is my cell:

=MAX(0,((N29-(K29+L29+M29)-40)))

"Dave Peterson" wrote:

=max(0,yourformula)



James23 wrote:

How do I get a simple addition formula to return a zero in a cell if the
formula yields a negative number?


--

Dave Peterson


David Biddulph[_2_]

Returning zero if the results of a formula is a negative numbe
 
.... though of course the parentheses around K29+L29+M29 *are* significant.
--
David Biddulph

"dlw" wrote in message
...
You don't need all the parens, unless it helps with understanding the
formula, when adding and subtracting, it doesn't matter the order in which
you do it.

"James23" wrote:

This is my cell:

=MAX(0,((N29-(K29+L29+M29)-40)))

"Dave Peterson" wrote:

=max(0,yourformula)



James23 wrote:

How do I get a simple addition formula to return a zero in a cell if
the
formula yields a negative number?

--

Dave Peterson





All times are GMT +1. The time now is 04:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com