ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Creating a function that makes a negative number a zero (https://www.excelbanter.com/excel-discussion-misc-queries/20183-creating-function-makes-negative-number-zero.html)

Tina

Creating a function that makes a negative number a zero
 
I am trying to create a function that will subtract, but if the answer is
less than zero, will put a zero in the cell. I don't know how to do this.
Can you help me?

hodeware

Try this


=IF(A1-A2<0,0,A1-A2)

with A1 & A2 being any cells

"Tina" wrote:

I am trying to create a function that will subtract, but if the answer is
less than zero, will put a zero in the cell. I don't know how to do this.
Can you help me?



Hi
You could try wrapping your formula in a MAX function:
=MAX(yourfunction,0)

--
Andy.


"Tina" wrote in message
...
I am trying to create a function that will subtract, but if the answer is
less than zero, will put a zero in the cell. I don't know how to do this.
Can you help me?





All times are GMT +1. The time now is 11:40 PM.

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