попробовать:
=ARRAYFORMULA(IFERROR(IF(B1:B<>"",,QUERY(IF(B1:B="",,
MMULT(N(TRANSPOSE(IF((TRANSPOSE(ROW(
INDIRECT("B1:B"&MAX(IF(B1:B="",,ROW(B1:B))))))>=ROW(
INDIRECT("B1:B"&MAX(IF(B1:B="",,ROW(B1:B))))))*(
{""; TRANSPOSE(TRIM(SPLIT(QUERY(REPT("♦"&ROW(INDIRECT("B1:B"&COUNTBLANK(
INDIRECT("B1:B"&MAX(IF(B1:B="",,ROW(B1:B))))))), 2)&"♦",,999^99), "♦")))}=TRANSPOSE(
{""; TRANSPOSE(TRIM(SPLIT(QUERY(REPT("♦"&ROW(INDIRECT("B1:B"&COUNTBLANK(
INDIRECT("B1:B"&MAX(IF(B1:B="",,ROW(B1:B))))))), 2)&"♦",,999^99), "♦")))})),
INDIRECT("B1:B"&MAX(IF(B1:B="",,ROW(B1:B)))), 0))), ROW(
INDIRECT("B1:B"&MAX(IF(B1:B="",,ROW(B1:B)))))^0)), "offset 2", 0))))