Требуется сгруппировать по строкам
Мой Eg
Ячейка A2 (Группы имен):
=ArrayFormula(IF(B2:B<>"",FLOOR((ROW(A2:A)-2)/5)+1,""))
Столбец B (Ваши данные)
Ячейка E2 (Результат):
=QUERY({QUERY({A2:B},"select Col1,sum(Col2) where Col1>0 group by Col1");
QUERY({A2:B},"select Col1,Col2 where Col1>0")},
"select Col2 where Col1>0 order by Col1,Col2 label Col2 ''")
![enter image description here](https://i.stack.imgur.com/ldIcd.png)
Ссылки на функции