01 set.xlsx | |||||||||
---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | |||
35 | 08.10.2021 05:02:52.264 GMT+0800 | 1.15563 | 1.1553 | 1 | 0 | 11 | |||
36 | 08.10.2021 05:03:04.109 GMT+0800 | 1.15563 | 1.1553 | 0 | 0 | ||||
37 | 08.10.2021 05:03:04.214 GMT+0800 | 1.15561 | 1.15533 | 1 | 1 | 1 | 1 | ||
38 | 08.10.2021 05:03:04.371 GMT+0800 | 1.15563 | 1.15532 | 1 | 1 | 2 | |||
39 | 08.10.2021 05:03:14.825 GMT+0800 | 1.15563 | 1.15535 | 0 | 1 | 3 | |||
40 | 08.10.2021 05:03:23.223 GMT+0800 | 1.15562 | 1.15535 | 1 | 0 | 1 | |||
41 | 08.10.2021 05:03:28.842 GMT+0800 | 1.15562 | 1.15537 | 0 | 1 | 1 | |||
42 | 08.10.2021 05:03:35.654 GMT+0800 | 1.15562 | 1.15539 | 0 | 1 | 2 | |||
43 | 08.10.2021 05:03:41.993 GMT+0800 | 1.15558 | 1.15539 | 1 | 0 | 1 | |||
44 | 08.10.2021 05:03:45.004 GMT+0800 | 1.15558 | 1.15538 | 0 | 1 | 1 | |||
45 | 08.10.2021 05:04:11.278 GMT+0800 | 1.15558 | 1.15537 | 0 | 1 | 2 | |||
46 | 08.10.2021 05:04:42.262 GMT+0800 | 1.15562 | 1.15537 | 1 | 0 | 1 | |||
47 | 08.10.2021 05:04:50.305 GMT+0800 | 1.15562 | 1.15539 | 0 | 1 | 1 | |||
48 | 08.10.2021 05:04:50.515 GMT+0800 | 1.15562 | 1.15538 | 0 | 1 | ||||
49 | 08.10.2021 05:04:51.255 GMT+0800 | 1.1556 | 1.15539 | 1 | 1 | 1 | |||
50 | 08.10.2021 05:04:55.111 GMT+0800 | 1.15561 | 1.15537 | 1 | 1 | 2 | |||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
D35:E50 | D35 | =IF(B35<>B34,1,0) |
F35:G50 | F35 | =IF(AND(D34=0,D35<>0),D35,IF(AND(D36=0,D35<>0),ROW(F35)-IFERROR(MATCH(1E+100,F$2:F34),0),"")) |
With that much data, I would suggest a macro. With post #3 I didn't really understand what part, if any you wanted help with but for the layout in post #1, try thisSample of 50-100k row set data:
Sub Result()
Dim a As Variant, b As Variant
Dim i As Long, k As Long
a = Range("A1", Range("A" & Rows.Count).End(xlUp).Offset(1)).Value
ReDim b(1 To UBound(a), 1 To 1)
b(1, 1) = "Result"
For i = 2 To UBound(a)
If a(i, 1) = 1 Then
k = k + 1
Else
If a(i - 1, 1) = 1 Then
b(i - 1, 1) = k
k = 0
End If
End If
Next i
Range("B1").Resize(UBound(b)).Value = b
End Sub