How? Deleting Non Recurring Data

dzdncfsd

New Member
Joined
Sep 21, 2006
Messages
2
I have a very large spreadsheet and I'm trying to cleanup.

Let me give you a brief description of the spreadsheet.

I have 3 columns of importance

Column 1 = Item #
Column 2 = Date
Column 3 = Location

What I'm looking to do is erase any data where there are less then 2 occurances of the same item # for each location.

1st option = I subtotalled based on date/item/location however I'm not sure how to sort based on the subtotal. If there is a way to do this that would resolve my issue.

2nd option = Would it be possible to create a macro to say if there are less then 2 occurances of the same item # for a given location delete the row.


I would do this manually however we're talking about 50,000 lines of data.


Thank You
DZDNCFSD
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,884
Hi dzdncfsd
Welcome to the board

You don't need any macro. Just filter the combinations and delete the lines.

To delete all combinations of occurances of only one item # for each location:

Assuming row 1 has the headers, and data is in A3:C50000:

D1="Test"

In D2:
Code:
=SUMPRODUCT(--($A$2:$A$50000=A2),--($C$2:$C$50000=C2))=1
Copy down to D50000

Select column D.
Data>Filter>Autofilter

Select in the autofilter dropdown list: True
Delete the visible lines

Disable the autofilter.
Delete column D.

Hope this helps
PGC
 

dzdncfsd

New Member
Joined
Sep 21, 2006
Messages
2
Thanks for the help... This did exactly what I needed it to.


Now the bad part is running this against 46,000 lines basically shut my computer down for 4 hours.
 

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,884
Hi dzdncfsd

Now the bad part is running this against 46,000 lines basically shut my computer down for 4 hours.

I'm afraid this may be my fault.

I forgot a very important step. After copying the formula down to D50000 one should select column D, Copy, Paste Special Values.

This way the sheet would only have constants and I believe this would have speeded up the process a lot.

If this is a process you have to execute more times try it next time.

Cheers
PGC
 

Forum statistics

Threads
1,137,193
Messages
5,680,086
Members
419,880
Latest member
suarezprado

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top