+ Reply to Thread
Results 1 to 5 of 5

Moving a row to another sheet based on two cells criteria

  1. #1
    Registered User
    Join Date
    01-30-2016
    Location
    OKC
    MS-Off Ver
    2010
    Posts
    3

    Moving a row to another sheet based on two cells criteria

    I apologize if this is a repeat post. I have searched through the forum and found many move macros based on a single cells criteria. Myself being new to macros I am unable to modify them to do what I would like. My issue is I have 10,000 plus rows of data. In column "B" there are numbers starting at 1. In column "A" there are text and numbers. I would like to search column "B" for any number greater than 1. When it finds a number greater than 1 it looks at the value from the corresponding column "A" cell. It then searches the entire column "A" for that value and moves any row containing that value (no matter the value in column "B") to sheet3, deleting it from sheet1. Maybe a better way to explain it, is if the value in column "A" has a value ofther than "01" then all rows containing that column "A" value will be moved to sheet3. Below is an example of the data in case my wording is not clear. 14gh1234 would stay on sheet1 as it only has a column "B" value of 01. All rows for 15ty4567 would be moved to sheet3 as it has values other than 01 associated with it. Any help would be greatly appreciated.

    14gh1234 01
    14gh1234 01
    14gh1234 01
    15ty4567 01
    15ty4567 01
    15ty4567 02

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

    Re: Moving a row to another sheet based on two cells criteria

    There might be a simple way of doing this by formula

    Type =AVERAGEIF(A:A,A1,B:B) in C1 and copy down.

    If the function gives an answer greater than 1 there must be a number greater than 1 for the column A value in column B. Then just use filtering to get at the desired rows.
    Martin

  3. #3
    Registered User
    Join Date
    01-30-2016
    Location
    OKC
    MS-Off Ver
    2010
    Posts
    3

    Re: Moving a row to another sheet based on two cells criteria

    Thanks for the quick response. That method would allow me to sort and manually cut and paste to a different page. I would like to have it doe automatically if possible due to having 10,000 plus rows, with that number increasing each month. I need it to search column B for a number greater than 1, then take the value of column A for that row and search all of column A for that value. As it finds values matching that value it moves them to sheet two. I need to perform various math functions to the data based on if the column A values have multiple column B values. That is also dependent on other things found in the rows. I would just be easier to perform all of the other functions I need to do if I could separate the data based on the above mentioned criteria.

    Please Login or Register  to view this content.

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

    Re: Moving a row to another sheet based on two cells criteria

    You could combine the two strategies - the addition of the formula, filtering and copying can be performed by macro and can therefore be integrated with what you already have. Try recording it to get the syntax.

    A more iterative approach is likely to be less efficient and take longer to run.

  5. #5
    Registered User
    Join Date
    01-30-2016
    Location
    OKC
    MS-Off Ver
    2010
    Posts
    3

    Re: Moving a row to another sheet based on two cells criteria

    I want to thank you for your help. That idea never crossed my mind for some reason. Some times it just takes a second opinion. I tend to over complicate things on a regular basis. I will use your formula above =AVERAGEIF(A:A,A1,B:B) and convert the results to values. Then I will sort the data using that column and simply cut and paste the data to a new sheet. I will just do it all manually at the moment until I can get the macro worked out to do it for me. I am not sure how to mark this question as solved. If you could direct me on how to do that, it would be appreciated. Again thanks for the quick responses.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Moving Rows to different sheet based on cell criteria
    By SpreadsheetNublet in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-08-2015, 03:12 PM
  2. moving data from one sheet to another based on criteria
    By premis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2013, 12:50 PM
  3. [SOLVED] need help moving info from one sheet to another sheet based on criteria
    By MariahD24 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 12-24-2012, 03:20 AM
  4. Moving rows of data to a new sheet based on date criteria
    By kaufmann98 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2012, 01:41 PM
  5. [SOLVED] Moving rows to a different sheet based on yes/no criteria
    By mpc_2012 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-25-2012, 06:01 AM
  6. Moving row in one sheet to another sheet based upon criteria
    By dcpeak in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-24-2012, 10:34 AM
  7. Moving data to another sheet based on criteria
    By jantonio in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-06-2009, 12:24 PM

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