Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 128
Default Possible VB code to lookup and remove unwanted data

I've got around 53k rows of data in an excel worksheet, labelled Data. Each
row has a customer ID. I've put all the data into a pivot table on another
worksheet, which is how I want to display the results. However, I don't need
data for all customer ID's. In a separate worksheet, I've got a list of
unique customer ID's that I need information on.
Is there any way (perhaps VB code/macro?) that I can look in the datafile of
53k rows, find a customer ID, compare that with the unique list of ID's and
if it's in there then ignore it (not do anything with it), and if it isn't in
there, remove it from the datafile?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Possible VB code to lookup and remove unwanted data

One simple procedure using autofilter on a helper col
to effectively deal with this ..

Assume the unique customer IDs are in a sheet: x
running in A2 down

In sheet: Data, assume the cust IDs are running in A2 down
Insert a new col A
Put in A2:
=ISNUMBER(MATCH(B2,x!A:A,0))
Copy A2 down to the last row of data in col B
Col A will flag all matching ids as TRUE, FALSE otherwise

The rows with FALSE are the ones to be deleted
To do this, just apply autofilter on col A, filter out: FALSE
Then select all the filtered rows, Right-click Delete Row
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Sarah (OGI)" wrote:
I've got around 53k rows of data in an excel worksheet, labelled Data. Each
row has a customer ID. I've put all the data into a pivot table on another
worksheet, which is how I want to display the results. However, I don't need
data for all customer ID's. In a separate worksheet, I've got a list of
unique customer ID's that I need information on.
Is there any way (perhaps VB code/macro?) that I can look in the datafile of
53k rows, find a customer ID, compare that with the unique list of ID's and
if it's in there then ignore it (not do anything with it), and if it isn't in
there, remove it from the datafile?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 128
Default Possible VB code to lookup and remove unwanted data

Max

That's great, thank you so much for your help (and no vb code in sight!!)

Cheers
Sarah

"Max" wrote:

One simple procedure using autofilter on a helper col
to effectively deal with this ..

Assume the unique customer IDs are in a sheet: x
running in A2 down

In sheet: Data, assume the cust IDs are running in A2 down
Insert a new col A
Put in A2:
=ISNUMBER(MATCH(B2,x!A:A,0))
Copy A2 down to the last row of data in col B
Col A will flag all matching ids as TRUE, FALSE otherwise

The rows with FALSE are the ones to be deleted
To do this, just apply autofilter on col A, filter out: FALSE
Then select all the filtered rows, Right-click Delete Row
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Sarah (OGI)" wrote:
I've got around 53k rows of data in an excel worksheet, labelled Data. Each
row has a customer ID. I've put all the data into a pivot table on another
worksheet, which is how I want to display the results. However, I don't need
data for all customer ID's. In a separate worksheet, I've got a list of
unique customer ID's that I need information on.
Is there any way (perhaps VB code/macro?) that I can look in the datafile of
53k rows, find a customer ID, compare that with the unique list of ID's and
if it's in there then ignore it (not do anything with it), and if it isn't in
there, remove it from the datafile?

  #4   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Possible VB code to lookup and remove unwanted data

Welcome, Sarah.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Sarah (OGI)" wrote in message
...
Max

That's great, thank you so much for your help (and no vb code in sight!!)

Cheers
Sarah



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove unwanted custom toolbar laura_in_abq Excel Discussion (Misc queries) 3 January 7th 08 09:55 PM
remove unwanted spaces? Nige Danton Excel Worksheet Functions 5 December 7th 07 01:10 PM
HOW DO I REMOVE AND UNWANTED FUNCTION IN A CELL OR GROUP OF CELLS SirCharles Excel Worksheet Functions 3 November 10th 07 03:30 AM
remove unwanted text after the 7th position George P Excel Discussion (Misc queries) 2 January 25th 07 12:04 AM
In excel, how do I remove unwanted lines for printing Darren N Excel Discussion (Misc queries) 1 October 2nd 06 01:41 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"