Somthing I would find helpfull

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chrisjc
    Contributor
    • Nov 2006
    • 375

    Somthing I would find helpfull

    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
  • Tig201
    New Member
    • Mar 2007
    • 103

    #2
    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.

    Comment

    • SammyB
      Recognized Expert Contributor
      • Mar 2007
      • 807

      #3
      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

      Comment

      • Chrisjc
        Contributor
        • Nov 2006
        • 375

        #4
        Originally posted by SammyB
        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

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by Chrisjc
          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.

          Comment

          • SammyB
            Recognized Expert Contributor
            • Mar 2007
            • 807

            #6
            Originally posted by Chrisjc
            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?

            Comment

            Working...