Fastest method to delete rows (set off)

amolwakchaure

New member
Joined
Sep 18, 2014
Messages
1
Reaction score
0
Points
0
Hi, Need help to delete rows (set off summary of records which are not matching) in same Business Unit same Department and same Amount(sum should be 0) and Reference should be start with (left 1 character) 1 and L. i already have a macro in place with While Wend loop but it takes more than 4 hours for deleting 50K rows. i read it in forum that collections/Array can do this very fast but i am not much aware of Collection/Array.
e.g. if we select first row which is 301, 900, 1*, -27137.64 will have to loop through remaining 3 records of department 900 if found will delete both rows. also just to speed up process will have to skip records which are already searched and matched or not matched and delete all matched rows at the end of process by using Union.



Business Unit
Department Reference Amt
301900 14135-CBP98-27137.64
301900 LO07819577140027137.64
301900 LO078095807000-518974.5
301900 14135-CBP9837205.43
301 0CB14134-XFQ17-23948000
301 0CBLO07815099140023948000
301 0GDLO0781109455001500000
301 0GD14133-SWX32-4500000
116 0NG14104-YSW9218717.93
116 0NGLO077199301100-18717.93
116 0NG14122-IKY8431263.54
116 0NGLO077773408800-31263.54
116 0NGLO077609295800-27137.64
116 0NG14133-RGY4227137.64
 
I would add a helper column with a formula starting in row 2 of

=OR(AND(A2=A1,B2=B1,SUM(D1:D2)=0),AND(A2=A3,B2=B3,SUM(D2:D3)=0))

then autofilter that column for FALSE and delete all the rows.
 
Back
Top