the example is confusing as Col D contains both Leaf Cost and {expected?} Node Sub Totals
if you removed the node totals from Col D (e.g. X1, X2, X8 etc) such that you only stored Leaf cost we could replicate your Col D results, in another column, using:
Formula:
K3:
=SUM(D3:INDEX(D:D;ROW(D3)+MATCH(TRUE;INDEX(N(+A4:A$29)<=A3;0);0)-1))
copied down
which would replicate the expected results.
however, if, as I suspect, this isn't what you need, I can only suggest posting a sample that better illustrates where the leaf-costs are stored (e.g. X3)
Bookmarks