L
LuisE
I have a large file, part number in column A and dollars in column B. I need
to delete all the transactions related to the same part which value is an
offset of another transaction.
When I sort it by Absolute number, it’ll put the negatives quantities first
and then the positive. When there are single occurrences for both cases
(+/-), I can delete them easily. The problem arises when I have let’s say
groups of 3 negatives and 3 positives or even worse 3 negatives and 4
positives. There is no other field to associate them for sorting.
Any thoughts?
Sub offset()
For j = ActiveSheet.Cells(Rows.count, "A").End(xlUp).Row To 2 Step -1
If Cells(j,1).Value = Cells(j - 1, 1).Value Then
If Cells(j, 2).Value = -1 * (Cells(j - 1, 2).Value) Then
Cells(j, 1).Rows.EntireRow.Delete
End If
End If
Next j
End Su
to delete all the transactions related to the same part which value is an
offset of another transaction.
When I sort it by Absolute number, it’ll put the negatives quantities first
and then the positive. When there are single occurrences for both cases
(+/-), I can delete them easily. The problem arises when I have let’s say
groups of 3 negatives and 3 positives or even worse 3 negatives and 4
positives. There is no other field to associate them for sorting.
Any thoughts?
Sub offset()
For j = ActiveSheet.Cells(Rows.count, "A").End(xlUp).Row To 2 Step -1
If Cells(j,1).Value = Cells(j - 1, 1).Value Then
If Cells(j, 2).Value = -1 * (Cells(j - 1, 2).Value) Then
Cells(j, 1).Rows.EntireRow.Delete
End If
End If
Next j
End Su