The first listed as number POSID, including 8201, 9202, 2017201, each repeat number 24 times;
The second as a TIME to TIME, each number POSID corresponds to 7:00, 1:20,... Her twenty-four hour;
The third for SPEED SPEED, each POSID at different times, there is a SPEED value,
I demand:
Find out the SPEED change rate is less than 20% of cell, when total cell number more than 3, marked with blue these cell content;
With pictures the data, for example:
The first step: to compare the third row and the second line SPEED column data, rate 7.89% & lt; 20%, continue to compare the fourth row and the third line SPEED column data, change for 12.86% & lt; 20%, continue to
Comparing the fifth line and the fourth line SPEED column data, rate is still less than 20%; . Until the
Comparing the ninth line and line 8 SPEED column data, rate of 25% & gt; 20%
The second step: to compare the first ten lines and on the eighth line SPEED column data, rate of 30%, continue to
Comparing the eleventh line and line 8 SPEED column data, rate of 40%,... Until the
Compared with 16 rows 8 SPEED column data, rate of 15% & lt; 20% is stopped and the eighth line SPEED column data comparison,
The third step: statistical rate is not less than 20% continuous cell number is 8 & gt; 4,
Step 4: seed selection rate is not less than 20% of the cells in a row, marked with blue,
Step 5: to compare the line 17 and 16 line SPEED column data, repeat the above steps, the cell until we find the full foot conditions, marked with red,
I use VBA plait code, can't achieve the purpose of my own: (
Still hope expert help, thank you!
CodePudding user response:
Forgot to bring my own code with:)CodePudding user response:
The code is as follows:Sub TuBian ()
Dim As Integer I
Dim j As Integer
Dim As Integer k
Dim As a Single
Dim As Integer l
K=0
For I=2 To 18
For j=3 To 18
A=Abs (Cells (j, 3). The Value - Cells (I, 3). The Value)/Cells (I, 3). The Value)
If a & lt; 0.2 Then
Next j
Next I
ElseIf a & gt;=0.3 Then
K=k + 1
L=k
If l & gt; 3 Then
M=j - l - 1
Cells (m, 3). Select
Cells (j, 3). Select
Range (Km: Kj "). Select
Cells (j, 3). Select
Selection. The Font. ColorIndex=5
I=j
End the If
Next j
Next I
End Sub
CodePudding user response:
Is not very understanding,But a little suggestion: first to calculate the changes of the upper and lower, such as 70, the rate of no more than 20%, the range of 56-84, later as long as the direct comparison to size, so that your code will be more simple, can also convenient to debug a lot...
CodePudding user response:
Ok, I will try, thank you!