try the following formula:
Formula: copy to clipboard
=IF(C4="",IF(C3>C2,C1-C3,C1-C2),C1-C4)