B1公式:
=IF(AND(A1>=0,OR(A2="",A2<0)),LOOKUP(1,0/(A$1:A1>=0),ROW(A$1:A1))-IF(MIN(A$1:A1)>=0,0,LOOKUP(1,0/(A$1:A1<0),ROW(A$1:A1))),"")
下拉
C1公式
=IF(AND(A1<0,OR(A2="",A2>=0)),LOOKUP(1,0/(A$1:A1<0),ROW(A$1:A1))-IF(MAX(A$1:A1)<0,0,LOOKUP(1,0/(A$1:A1>=0),ROW(A$1:A1))),"")
下拉
B1=IF(SIGN(A1)=SIGN(A2),"",IF(AND(SIGN(A$1:A1)=SIGN(A1)),COUNT(A$1:A1),MATCH(-SIGN(A1),SIGN(N(OFFSET(A1,1-ROW(A$1:A1),))),)-1))
同时按下CTRL+SHIFT+ENTER输入数组公式,用自动填充柄下拉,补充的已经有人回答了,我就不答了。
=COUNTIF(A1:A1000,"<0") 负数
=COUNTIF(A1:A1000,">=0") 正数