Use Excel Magical functions to Insert a Blank Row After Every Change of Product
Let’s do it step by step :
1- =SEQUENCE(ROWS(B4:E13))
2- =B4:B13=B5:B13
3- =DROP(H4#,-1)
Which is : =DROP(B4:B13=B5:B13,-1)
4- =I4#*1
Which is : =DROP(B4:B13=B5:B13,-1)*1
5- =VSTACK(1,J4#)
Which is : =VSTACK(1,DROP(B4:B13=B5:B13,-1)*1)
6- =FILTER(G4#,K4#=0)
Which is : =FILTER(SEQUENCE(ROWS(B4:E13)),VSTACK(1,DROP(B4:B13=B5:B13,-1)*1)=0)
7- =HSTACK(G4#,B4:E13)
Which is : =HSTACK(SEQUENCE(ROWS(B4:E13)),B4:E13)
8- =IFNA(VSTACK(L4#,M4#),"")
Which is : =IFNA(VSTACK(FILTER(SEQUENCE(ROWS(B4:E13)),VSTACK(1,DROP(B4:B13=B5:B13,-1)*1)=0),HSTACK(SEQUENCE(ROWS(B4:E13)),B4:E13)),"")
9- =SORT(C18#,1,1)
Which is : =SORT(IFNA(VSTACK(FILTER(SEQUENCE(ROWS(B4:E13)),VSTACK(1,DROP(B4:B13=B5:B13,-1)*1)=0),HSTACK(SEQUENCE(ROWS(B4:E13)),B4:E13)),""),1,1)
10- =DROP(I18#,,1)
Which is :
=DROP(SORT(IFNA(VSTACK(FILTER(SEQUENCE(ROWS(B4:E13)),VSTACK(1,DROP(B4:B13=B5:B13,-1)*1)=0),HSTACK(SEQUENCE(ROWS(B4:E13)),B4:E13)),""),1,1),,1)
<< In one formula :>>
=LET(
a, B4:E13,
b, TAKE(a, , 1),
c, SEQUENCE(ROWS(a)),
DROP(
SORT(
IFNA(
VSTACK(
FILTER(
c,
VSTACK(1, DROP(b = DROP(b, 1), -1) * 1) = 0
), HSTACK(c, a) ), ), 1, 1), , 1))