SOLVED

# How to write a formula for a specific function

Highlighted
Occasional Contributor

# How to write a formula for a specific function

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
Highlighted

# Re: How to write a formula for a specific function

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

Highlighted

# Re: How to write a formula for a specific function

@rgoins82 That could be like in the picture below.

Highlighted
Best Response confirmed by rgoins82 (Occasional Contributor)
Solution

# Re: How to write a formula for a specific function

Try:

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

# Re: How to write a formula for a specific function

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

# Re: How to write a formula for a specific function

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!!

Highlighted

# Re: How to write a formula for a specific function

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

Highlighted

# Re: How to write a formula for a specific function

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