PC Review


Reply
Thread Tools Rate Thread

deleting rows in large database (+20k rows)

 
 
=?Utf-8?B?bXdhbTQyMw==?=
Guest
Posts: n/a
 
      8th Aug 2007
i need to delete all rows whose account numbers do not match a set of 20-30
account numbers. since the database is quite large was planning to use Union
application to create range of rows to be deleted.

what is easiest method to distinguish between rows containing the 20-30
account numbers i want to save and the hundreds which need to be deleted?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      8th Aug 2007
No macros are necessary:

in sheet1 A1:A30 put in your 20 or 30 values

in the next empty column in the sheet with your data (assume account numbers
are in column C, assume the empty column is M) so in M2

=Countif(Sheet1!$A$1:$A$30,C2)

fill down the column and apply an autofilter. Filter on zero

select all the rows except row 1. Delete the rows. Only the visible rows
will be deleted. Remove the Autofilter.

dleete the "dummy" column.

--
Regards,
Tom Ogilvy


"mwam423" wrote:

> i need to delete all rows whose account numbers do not match a set of 20-30
> account numbers. since the database is quite large was planning to use Union
> application to create range of rows to be deleted.
>
> what is easiest method to distinguish between rows containing the 20-30
> account numbers i want to save and the hundreds which need to be deleted?

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      8th Aug 2007
I would insert a new worksheet.
Put the 20 to 30 account numbers in A1:A20 (or A30)

Then I would insert a new column adjacent to the column with all the account
numbers in it. I had the account numbers in A1:a20000 and inserted a new column
B.

Then with those 20-30 account numbers in Sheet2, I used this formula in B1:

=isnumber(match(a1,sheet2!a:a,0))
and dragged down all the rows.

Then I'd convert that column B to values
(select column B, edit|Copy, edit|Paste special|Values)

Next I'd sort that data by column B.

And then apply data|Filter|autofilter to that column B.

Show the false values
Delete the visible rows

and then remove the filter.

mwam423 wrote:
>
> i need to delete all rows whose account numbers do not match a set of 20-30
> account numbers. since the database is quite large was planning to use Union
> application to create range of rows to be deleted.
>
> what is easiest method to distinguish between rows containing the 20-30
> account numbers i want to save and the hundreds which need to be deleted?


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?bXdhbTQyMw==?=
Guest
Posts: n/a
 
      9th Aug 2007
hi tom, appreciate the reply, as well as the nifty use of countif formula =D
database is also fodder for pivot table, if using a dynamic data source are
there any issues i need to know about?

"Tom Ogilvy" wrote:

> No macros are necessary:
>
> in sheet1 A1:A30 put in your 20 or 30 values
>
> in the next empty column in the sheet with your data (assume account numbers
> are in column C, assume the empty column is M) so in M2
>
> =Countif(Sheet1!$A$1:$A$30,C2)
>
> fill down the column and apply an autofilter. Filter on zero
>
> select all the rows except row 1. Delete the rows. Only the visible rows
> will be deleted. Remove the Autofilter.
>
> dleete the "dummy" column.

 
Reply With Quote
 
=?Utf-8?B?bXdhbTQyMw==?=
Guest
Posts: n/a
 
      9th Aug 2007
hi dave, thanks for the response. your solution, and tom's above, are
basically the same; appreciate the help (our whole office appreciates your
help), you guys are real pros =D

"Dave Peterson" wrote:

> I would insert a new worksheet.
> Put the 20 to 30 account numbers in A1:A20 (or A30)
>
> Then I would insert a new column adjacent to the column with all the account
> numbers in it. I had the account numbers in A1:a20000 and inserted a new column
> B.
>
> Then with those 20-30 account numbers in Sheet2, I used this formula in B1:
>
> =isnumber(match(a1,sheet2!a:a,0))
> and dragged down all the rows.
>
> Then I'd convert that column B to values
> (select column B, edit|Copy, edit|Paste special|Values)
>
> Next I'd sort that data by column B.
>
> And then apply data|Filter|autofilter to that column B.
>
> Show the false values
> Delete the visible rows
>
> and then remove the filter.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting Rows In a Database carl Microsoft Access Queries 1 15th Apr 2011 06:19 PM
Very large database (600k rows, 40 columns in xlsx) Przemyslaw Robak Microsoft Excel Misc 4 5th Nov 2009 08:17 AM
My database is deleting rows by itself?? Adele Microsoft Access Database Table Design 3 20th Oct 2009 01:53 PM
Deleting Rows in Large Table T. Jenkins Microsoft Excel Programming 3 5th Apr 2008 07:20 AM
large database with multiple rows Steve Microsoft Excel Worksheet Functions 2 14th Jan 2008 02:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:28 PM.