By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

Somthing I would find helpfull

Chrisjc
100+
P: 375
I only took a class on VB because I had to for school I don't recall all to much of it.. But I have a job now doing database administration. And I have to sort part numbers that are duplicated several times.. (I.E.)
========================================
49-10049
49-10049
49-10049
49-10049
49-10051
49-10051
49-10051
========================================

And this can be up to 200 lines... My question for anyone who could help me. I was thinking couldnít I make a program in VB when I would load a TEXT full of these part numbers that are duplicated and then hit something like "SORT TO SINGLE" and it will take that list and make it into
========================================
49-10049
49-10051
========================================

This way I dont have to delete the part numbers out one by one like I have been doing.. This is a head ache... and would be grate if I can get a simple APPLICATION that can do this... Could any of you help me out please? Any or maybe code that for me?? WOULD BE A HUGE HELP!!! and save me a lot of time at work! Or maybe someone knows a program already like this????

So basic operation of the APPLICATION would be.

Open a text file in the APP that has duplicated part numbers in a format of
10-00000

Then take all duplicates out and only leave one of each part number....
So the out put would be the 2nd list of part numbers below. And the input would have been letís say
10-00000
10-00000
10-00000 Program would take out those 2 and leave one. Is this possible?

10-00000
10-00001
10-00002

Does this make sense please let me know THANK YOU!! In advanced!


-Chris
May 7 '07 #1
Share this Question
Share on Google+
5 Replies


Tig201
100+
P: 103
Couldn't you use a find duplicate query in in you databse manager and then use the results of that to populate the table in the database. I know this can be done in access but you didn't mention what your database software was.
May 7 '07 #2

SammyB
Expert 100+
P: 807
In case the DB solution cannot be done (isn't this just SELECT DISTINCT ...), you can easily remove duplicate data with Excel.

Just open your data file with Excel, insert a row at the top and put a label over the column ("Label" is fine, XL just wants something). Now, select the entire column (click on the "A"), and use the Data, Filter, Advanced Filter menu. In the dialog, tick Copy to another location, Copy to B1, place a checkmark in Unique records only, and press OK. Now, you can use the Edit, Delete menu item to delete the first column, select the header cell and delete it, and File, SaveAs to save your unique records.

Sam's First Rule of Programming: NEVER write a program that an Office App can already do. HTH --Sam
May 7 '07 #3

Chrisjc
100+
P: 375
In case the DB solution cannot be done (isn't this just SELECT DISTINCT ...), you can easily remove duplicate data with Excel.

Just open your data file with Excel, insert a row at the top and put a label over the column ("Label" is fine, XL just wants something). Now, select the entire column (click on the "A"), and use the Data, Filter, Advanced Filter menu. In the dialog, tick Copy to another location, Copy to B1, place a checkmark in Unique records only, and press OK. Now, you can use the Edit, Delete menu item to delete the first column, select the header cell and delete it, and File, SaveAs to save your unique records.

Sam's First Rule of Programming: NEVER write a program that an Office App can already do. HTH --Sam

That worked grate just what I needed thank you!

I am using EXCEL just to get all the data together.. Then convert it to CSV and upload to PHPMYADMIN. Thanks for the replies

PS I will admit newbi to XL hahaha
May 7 '07 #4

Expert 5K+
P: 8,434
That worked grate just what I needed thank you!

I am using EXCEL just to get all the data together.. Then convert it to CSV and upload to PHPMYADMIN. Thanks for the replies

PS I will admit newbi to XL hahaha
Ah, but I'll bet you're learning a lot about it now. :)

Are you going to be doing this on a regular basis? If so, it might still be a good idea to develop a program to do it. Or perhaps a better idea would be a macro in Excel, to automate things a little without taking it out of your hands. That will probably be much simpler than doing a VB application.

Excel can actually do most of the work of macro creation for you. Just tell it to "Record a new macro". Then do the operation yourself. Once you stop the recording, you'll have the VBA code there to do it again. Chances are good that you will need to play with the code a bit, unless the operation will be precisely the same each time. But at least the code is already there.
May 8 '07 #5

SammyB
Expert 100+
P: 807
That worked grate just what I needed thank you!

I am using EXCEL just to get all the data together.. Then convert it to CSV and upload to PHPMYADMIN. Thanks for the replies

PS I will admit newbi to XL hahaha
That's a little known but very useful XL feature. Glad it worked for you: now people will think that you are an XL wizard! Nobody knows how to use Advanced Filter!

But, can't you just use SELECT DISTINCT ... in the original query?
May 8 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.