+ Reply to Thread
Results 1 to 4 of 4

Extracting rows based on multiple ranges and unique numbers

  1. #1
    Registered User
    Join Date
    03-18-2012
    Location
    SD
    MS-Off Ver
    2010
    Posts
    2

    Extracting rows based on multiple ranges and unique numbers

    I am a noob, so bare with me.

    I have a database with roughly 22,000 records. Each row has is a unique record, and contains a column with an identifier number (ID#).

    In a separate sheet, I have a large list of these ID#'s that need to have the entire row extracted and copied to another sheet.


    Attached is some dummy data. What I am trying to do is.. the ID# column in sheet1, needs to be extracted by the data in column 1 on sheet2 and the results pasted into a new sheet.

    I always feel like i am unclear... the numbers from sheet2, are the records i need extracted FROM sheet1.

    A friend has created some code for a macro, but it does not run properly. It appears to run correctly but pastes the results over itself, so at the end of running there is only the result of the last record. I can attach that if necessary, or start new.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Extracting rows based on multiple ranges and unique numbers

    Looks like you should be using advanced filter for this task. Have a look at Excel help for more details.

    Alternatively, you could use a COUNTIF function in a new column on your first sheet to identify those rows which have a common ID#. Filtering and then copying will give you your selected rows.
    Martin

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Extracting rows based on multiple ranges and unique numbers

    Its a bit clumsy, bit it gives you what (I think) you want? Altho, if you have lots of items you are searching for, with 22k rows, it will probably slow things down.

    Alternatively, as suggested, maybe filters might work for you, depending on what you are basing your selection on. In 2007, on the "home tab" select "sort and filter", and play around with that and see if that gives you what you want
    Attached Files Attached Files
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    03-18-2012
    Location
    SD
    MS-Off Ver
    2010
    Posts
    2

    Re: Extracting rows based on multiple ranges and unique numbers

    thanks for the reply,

    I have tried the advanced filter, I couldn't get it to cooperate and return the proper results. After several failed attempts more familiar excel users told me it can not be done the way I want, but they could not tell me how. I refuse to believe that it cant be done. When I did use it, it returned the entire database. I will try again.

    The list it needs to be sorted by is also large. And will be in a separate sheet. It will always be a large list of non-sequential numbers.

    If it helps to understand, this is a database of specimens, I have sent specimens away but only wrote down the ID number, The recipient now needs all the associated data (row)

    FDibbins, your solution is correct, but missing the columns to the left of the ID#.

    Thanks I will play with this when I have time.

+ 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