Try this in F1 if your data were in C1, D1 and E1

=IF(E1="",D1-C1,E1-C1)