Subtracting cells only if they have a value in Excel
Place the following formula in cell E2 to achieve what you want:
=IF(ISBLANK(D2),"",D2-C2)
If you want both cells to have a value:
=IF(OR(ISBLANK(D2),ISBLANK(C2)),"",D2-C2)
Place the following formula in cell E2 to achieve what you want:
=IF(ISBLANK(D2),"",D2-C2)
If you want both cells to have a value:
=IF(OR(ISBLANK(D2),ISBLANK(C2)),"",D2-C2)