我有几列数据3是键列a b和c
我需要检查col A中小于1.5的值
我只需要在col A中小于1.5的行上检查col B中的重复值,然后将这些行与Col C进行比较(如果C在满足A&B条件的情况下也具有重复值,则删除1个重复项,其中2 ab&c满足条件
示例。
A B C
1 1/4 30 1/2 30
1 1/4 30 1/2 30
1 1/4 30 1/2 30
1 1/4 30 1/2 30
1 1/4 30 31
1 1/4 28 1/4 31
1 1/4 30 1/2 31
1 1/4 11 14/45 32
1 1/4 11 14/45 32
1 1/4 13 1/2 35
1 1/2 21 33
1 1/2 21 33
运行后
A B C
1 1/4 30 1/2 30
1 1/4 30 1/2 30
1 1/4 30 31
1 1/4 28 1/4 31
1 1/4 30 1/2 31
1 1/4 11 14/45 32
1 1/4 13 1/2 35
1 1/2 21 33
当前代码有逻辑错误,没有调试信息。我也不知道如何从此处仅删除每组重复项中的一行。
Dim lrow As Long
Dim lrow2 As Long
Dim GotMatch As Long
Dim i As Long
Dim l As Long
lrow = Range("H:H,Q:Q").End(xlUp).Row
lrow2 = Range("P:P").End(xlUp).Row
For i = 8 & 17 To lrow
For l = 16 To lrow2
If Cells(i, 8 & 17) <> "" & Cells(i, 16) < 1.51 Then
GotMatch = WorksheetFunction.Match(Cells(i, 8 & 17), Range("H1:H,Q1:Q" & lrow), 0) & _
WorksheetFunction.Match(Cells(l, 16), Range("P:P" & lrow2), 0)
If i + l <> GotMatch Then
Cells(i + l).EntireRow.Delete
End If
End If
Next
Next