Are A1, A2, and A3 dates or a number of days or.....what?
If they're dates, then maybe this:
=IF(A3=0,A2-A1,A3-A1)
If they're numbers of days this:
=SUM(A1:A3) (it won't matter if A3 is empty or not)
When I put:
"2/10/18" in A1 formatted as a date
"2/15/18" in A2 formatted as a date
"2/25/18" in A3 formatted as a date
and:
"=IF(A3=0,A2-A1,A3-A1)" in A4 formatted as General.
It gives me a result of 15. If I clear A3, it changes to 5.
Not sure what's different in your workbook. It's hard for me to test it without being able to replicate the problem you're having.