Excel won't allow you to place a result formula in a reference cell which is referenced in the result formula. You'll receive a "circular reference" error message and the result will always be 0.
Hence, you will need to place your formula in A3 or B3.
I assume that you realise that the formula you have will give you the value of A2 if A1 is less than A2.
Thus, I would say that the following adjusted formula may be what you would need:-
I hope that this helps.