# IF function that leaves the last number calculated if statement is true/false

I am trying to write a formula that updates a number in the cell if another cell is empty, and leaves the last number calculated if the other cell is not empty. I am calculating my profit, which changes until I actually collect it, because my AMOUNT SPENT is a dollar value calculated from a price and quantity of bitcoin. So far I have this: `=IF(ISBLANK(K2),C2-H2,())` Where C2 is AMOUNT RECEIVED and H2 is AMOUNT SPENT i.e.

AMOUNT RECEIVED AMOUNT SPENT PROFIT
400 350 Amount received - amount spent

K2 is another cell somewhere that acts as a true/false mechanism. If it is not empty, that means I have collected the profit and it no longer varies (the amount spent is Bitcoin price x amount of bitcoin spent) so my profit changes until I convert between currencies. There is probably another way of going about this that I am too inexperienced to see. Sorry for any clarity issues, I am not great with this stuff.

• Please add some scenarios including sample input data and the corresponding expected result. – Rubén Apr 20 at 22:59
• Welcome. "Obviously it is not possible to do this. Prove me wrong". This sort of rhetoric is not appreciated. Try this `=IF(ISBLANK(K2),C2-H2,)` – Tedinoz Apr 21 at 8:32
• Sorry for the rhetoric, I find it helps me get answers faster. – Nojus Apr 21 at 12:21