用宏代码吧:
Sub www()
Dim i%, s1%, s2%, s3%, s4%, s5%, s6%
For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
If Cells(i - 1, 1) <> -1 And Cells(i, 1) = -1 And Cells(i + 1, 1) = -1 And Cells(i + 2, 1) <> -1 Then s1 = s1 + 1
If Cells(i - 1, 1) <> -1 And Cells(i, 1) = -1 And Cells(i + 1, 1) = -1 And Cells(i + 2, 1) = -1 And Cells(i + 3, 1) <> -1 Then s2 = s2 + 1
If Cells(i - 1, 1) <> -1 And Cells(i, 1) = -1 And Cells(i + 1, 1) = -1 And Cells(i + 2, 1) = -1 And Cells(i + 3, 1) = -1 And Cells(i + 4, 1) <> -1 Then s3 = s3 + 1
If Cells(i - 1, 1) <> 1 And Cells(i, 1) = 1 And Cells(i + 1, 1) = 1 And Cells(i + 2, 1) <> 1 Then s4 = s4 + 1
If Cells(i - 1, 1) <> 1 And Cells(i, 1) = 1 And Cells(i + 1, 1) = 1 And Cells(i + 2, 1) = 1 And Cells(i + 3, 1) <> 1 Then s5 = s5 + 1
If Cells(i - 1, 1) <> 1 And Cells(i, 1) = 1 And Cells(i + 1, 1) = 1 And Cells(i + 2, 1) = 1 And Cells(i + 3, 1) = 1 And Cells(i + 4, 1) <> 1 Then s6 = s6 + 1
Next i
[d2] = s1 '-1连2次
[d4] = s2 '-1连3次
[d6] = s3 '-1连4次
[d8] = s4 '1连2次
[d10] = s5 '1连3次
[d12] = s6 '1连4次
End Sub
追问谢谢您。请问以此类推连续连续5-6-7-8 在那个位置编辑,还有这个不会算重复吧?例如四个-1连续,它会不会显示出连续三次-1出现两次的情况