+ Reply to Thread
Results 1 to 13 of 13

Finding and copying rows that meet key word criteria

  1. #1
    Registered User
    Join Date
    10-28-2011
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    7

    Finding and copying rows that meet key word criteria

    Hi all.

    I am attempting to parse through 1000's rows of data to copy 3 specific rows that correspond to specific object (i.e., Dune Field). Each Dune field has a row that starts with "ROI", "Band 1", and "Band 2" that are irregularly spaced due to different dune field sizes. So for each of ~100+ dune fields I only need these three rows copied to another sheet.

    I followed this post:
    http://www.excelforum.com/excel-gene...ing-cells.html
    which is really close, but differ because I need: 1) to search for three key words, 2) copy all three rows and keep them in that order, and 3) the first criteria needs a wildcard for the "ROI" row as it has text after it (i.e., it is not a one word cell, but something like "ROI: EVF: Layer: Dune_Field.shp (Dune_ID=0597+369) [White] 85 points")

    Thanks much, and I have included a sample of my data to be sorted?
    MC
    Attached Files Attached Files
    Last edited by acrobaticgod; 10-29-2011 at 01:45 PM.

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Finding and copying rows that meet key word criteria

    You might wish to try a quick and dirty approach.

    Create a helper column (to retain the original sort position of every row) with consecutive numbers from 1 to ...., then sort all the data by the first column. Weed out what rows you don't need and then resort using the helper column.

  3. #3
    Registered User
    Join Date
    10-28-2011
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    7

    Re: Finding and copying rows that meet key word criteria

    Thanks, but the manually going through the 64,565 rows is unacceptable... Unless, I am not understanding your approach. Sort by name will loose valuable information in other rows (i.e., "ROI", "Band 1", and "Band 2" sets need to stay together).
    MC

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Finding and copying rows that meet key word criteria

    Once the data is sorted (Z to A), deleting the unwanted rows is simple - they're all together.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Finding and copying rows that meet key word criteria

    MC;
    what dangelor is saying:
    1) Create another column and put #s in that column 1.....64,565.
    2) Sort the data in any way that gives you the results you want.
    3) Sort on the added column to put your data back the way it was.
    4) Optional delete the added column.

    I'll look at your workbook and see if there is a way to have what you want done automatically.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  6. #6
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Finding and copying rows that meet key word criteria

    MC;
    If dangelor's solution works mark the thread solved.

    If not, give me an example of what you want to find, and an example of the way you want the results to look like.
    Do the results need to be on a different sheet, or can they just be at the top of the sheet to the right of the data?
    Do you want the found rows deleted from the data?
    Do you want to be able to do this over and over? or is this a one time only event?

  7. #7
    Registered User
    Join Date
    10-28-2011
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    7

    Re: Finding and copying rows that meet key word criteria

    Thanks Dangelor! That was it. I just needed to follow and Foxguy's steps and it worked fine.

    Yes Foxguy, I do need to do it several times, but these steps should get me through it.
    After I have sorted A-Z I would like to quickly delete all rows not meeting the criteria of three desired rows ("ROI", "Band 1", and "Band 2")? Also how do you delete rows with out them coming back?

    Any posts you could point me too?
    Thanks,
    MC

  8. #8
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Finding and copying rows that meet key word criteria

    After I have sorted A-Z I would like to quickly delete all rows not meeting the criteria of three desired rows ("ROI", "Band 1", and "Band 2")?
    I never quite understood how the criteria works. You would have to give me an example.
    Also how do you delete rows with out them coming back?
    I don't understand what you mean by "coming back". Once a row is deleted, it's gone. It can't come back.
    Unless you're using the wrong word. Walk though the steps you take to "delete" a row(s), so I can see what you're talking about.

  9. #9
    Registered User
    Join Date
    10-28-2011
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    7

    Re: Finding and copying rows that meet key word criteria

    Ok, for the second question, now my data is sorted and I have ~1000 rows of data I want to work with.
    To delete the remaining rows, I select row 1001 and hit ctr-shift down (highlighting down to row 1048576) then delete rows and/or cells. They are deleted momentarily, but then I scroll down again and all rows down to 1048576 are still there? I feel like all I am doing is clearing the contents?

    Sometimes I find a sheet where there is smaller number of rows, but when I work in there often the rows reappear down to 1048576? Is that because I am pasting a formula into a entire row (i.e., copy formula from A1 then highlighting column B and pasting).

    How do I limit a worksheet to a specific number of rows? I know how to hide the rows, but does that help reduce the .xls file size.

    Thanks,
    Great website!

  10. #10
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Finding and copying rows that meet key word criteria

    I have to leave for a couple of hours. I'll look at it when I get back.

  11. #11
    Registered User
    Join Date
    10-28-2011
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    7

    Re: Finding and copying rows that meet key word criteria

    Great.
    Yeah, my .xlsx is getting bigger with every formula paste.
    I am up to ~60 MB for a file with two sheets and no data below the first 600 lines or so. Hiding the rows doesn't really help either. Obviously I am missing something big.
    Sorry for the novice question....

    MC

  12. #12
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Finding and copying rows that meet key word criteria

    Here's a VBA procedure to accomplish the task.
    Please Login or Register  to view this content.
    Last edited by dangelor; 10-29-2011 at 04:34 PM.

  13. #13
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Finding and copying rows that meet key word criteria

    You will always have 1048576 rows. When you delete any row Excel adds a blank row at the bottom.
    1 thing you can do to help keep file size down:
    Click CTRL+END. That will take you to the bottom right cell of usedrange. If it's below or to the right of your data then delete all the rows below your data (like you were doing) and columns to the right of your data. Then save and close the file. That gets rid of rows & columns that Excel thought you were using.

    If you do a search in the forum for "File Size", I'm sure you will find other suggestions.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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