+ Reply to Thread
Results 1 to 2 of 2

Macro for generating unique list of data

Hybrid View

ekm Macro for generating unique... 07-28-2010, 05:24 PM
ekm Re: Macro for generating... 07-28-2010, 05:43 PM
  1. #1
    Registered User
    Join Date
    07-15-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Macro for generating unique list of data

    I perfrom semi-manual excel manipulations really frequently and although it takes me maybe 15 minutes each time to manipulate a list into what I need, I know that the repeated functions I do can be done with a macro with the click of a button. Unfortunately I am not familiar with VBA.

    I have a spreadsheet of document numbers and their revisions (columns A and B). The document numbers are repeated if there are multiple revisions of the same document. There are also additional columns with important information such as author, etc. and I need to maintain this data.

    I need to generate a unique list of documents and display their latest revision only.

    There is one caveat, the revisions are alpha and numeric. 'Alpha' revisions are anywhere from A to G (or higher) and are considered preliminary before they go to numeric revisions which are 0-99. so all alpha values are considered less than 0.

    For example, the list I start with could look like this:
    AAA-020 - A
    AAA-020 - 0
    BBB-010 - 0
    BBB-010 - 1
    AAA-020 - B
    CCC-010 - B
    CCC-010 - A
    BBB-010 - 2

    And I would want the final list to be
    AAA-020 - 0
    BBB-010 - 2
    CCC-010 - B

    And I also need to include the additional columns on the spreadsheet corresponding to the latest revision.

    I have been following these steps to make this happen:
    1. Insert 3 columns to the right of column B
    2. Because my actual highest alpha revision is 'G', I assign A to -7, B to -6, and so on with this formula in the newly created column C : =IF(B2="A",-7,IF(B2="B",-6,IF(B2="C",-5,IF(B2="D",-4,IF(B2="E",-3,IF(B2="F",-2,IF(B2="G",-1,B2)))))))
    3. The list I am dealing with is generated by another program which stores numbers as text, so I then highlight column B and go to Data-Text to columns and click through the screens to convert them to actual numbers
    4. Then I sort the list by column A and then by column C to get the documents in order sorted by revision (so that the latest revision appears at the bottom of the list).
    5. Then I paste this formula into column D to identify highest revision: =IF(A2=A3,0,1)
    6. I copy column D and use paste special to paste only the values from column D into column E
    7. And then I sort by column E and delete all of the rows that have a zero in column E and walla!

    Is there an easier way? I'm hoping someone can point me in the right direction.

    Thanks so much,
    Emily
    Last edited by ekm; 07-29-2010 at 05:54 PM. Reason: update title

  2. #2
    Registered User
    Join Date
    07-15-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Macro for generating unique list of data

    I apologize for my inadequate title

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1