=IF(A1=A2,N(B1),N(B1)+1)
=SCAN(0,A1:A10<>A2:A11,SUM)
▼函数公式有点长,但是很简单! =LET(t,SCAN(0,A1:A10<>A2:A11,SUM),VSTACK(A1:B1,DROP(GROUPBY(HSTACK(t,A2:A11),B2:B11,SUM),-1,1)))
=REDUCE(A1:B1,A2:A11,LAMBDA(x,y,IF(@TAKE(+x,-1,1)=y,VSTACK(DROP(x,-1),HSTACK(y,TAKE(x,-1,-1)+OFFSET(y,,1))),VSTACK(x,OFFSET(y,,,,2)))))