When a formula refers to a blank cell, Excel interprets the blank as 0.
So your formula in D5 =C5-C4 = 0 - 1163 = -1163
and D6 = C5 - C5 = 0 - 0 = 0, etc.

You could use =MAX(C5-C4,0) to prevent the negative numbers.

I personaly would avoid formulas like =IF(ISNUMBER(C5),C5-C4,"") that leave a string where other formulas may expect a number.