Does this do the trick?
=SUM(IF(ROW(A2:$A$20)-ROW(A2)<IFERROR(MATCH(TRUE,A3:$A$20<=A2,0),ROWS(A3:$A$20)),B2:$B$20,0))
I'm a bit confused why the parent/total SUMS columns seems to sometimes include the child values and other times not. e.g. why is it 25 in row 4 (the first row of level 2) but blank in rows 12 and 13? Also not sure why the last 2 rows are 89 with no child values.
Bookmarks