SOLVED

How to write a formula for a specific function

Copper Contributor

I think it is a simple formula but I just can't figure it out.   I am adding two cells to a third cell.  How do I write the formula that if the number in the 2nd cell is zero - do not add until it is greater than zero.  Effectively leaving the third cell with zero until a number is added in the 2nd cell.

 

Right now it looks like this:          25             0        -25

 

I want it to say:                             25             0           0    Until the number is added in the 2nd cell THEN preform the addition and show the results. 

 

Am I describing it well enough to explain my request? 

7 Replies

Actually - I am subtracting the 2nd cell from the first cell - hence the -25.  But I assume the formula is the same regardless.  

@rgoins82 That could be like in the picture below.

 

Screenshot 2020-07-29 at 16.00.51.png

best response confirmed by rgoins82 (Copper Contributor)
Solution
Try:

=IF(B1>0,B1-A1,0)

@rgoins82 

=IF(COUNTIF(rangewithtwocells,">0")=2,calculation,0)

Ok. I am getting and ERR504

 

This is exactly what I type for the formula: =IF(COUNTIF(E55,E55,">0")=2,D55-E55,0)

 

Can you correct it for me?

 

Thank you so much!!

I tried it this way as well: =IF(COUNTIF(D55,E55,">0")=2,E55-D55,0) 

Thanks to everyone!! It works and it was important for my spreadsheets! Thanks again!
1 best response

Accepted Solutions
best response confirmed by rgoins82 (Copper Contributor)
Solution
Try:

=IF(B1>0,B1-A1,0)

View solution in original post