OK...I understand.

Try this regular formula, copied down:
H4: =IF(I4,$E$4*J4,($E$4-SUM(I$4:I$27))*(J4/SUMIF(I$4:I$27,"",J$4:J$27)))
and use this formula for your total:
H28: =SUMIF(I4:I27,"",H4:H27)+SUM(I4:I27)
Does that help?