You can either use SUMIF or SUMIFS function to calculate sum with the criteria of “Sum if not blank”.
By using SUMIF function
How the formula works
In the SUMIF function:
A4:A8 – The range of cells that we want to be evaluated against our criteria. (e.g. not-equal-to)
“<>” – The standard Excel operator which is the input of ‘not-equal-to’.
C4:C8 – The actual cells to add against our criteria.
By using SUMIFS function