+ Reply to Thread
Results 1 to 10 of 10

copy complete rows based on criteria of cells

  1. #1
    Registered User
    Join Date
    12-09-2018
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    3

    copy complete rows based on criteria of cells

    Hi all - I am using Excel2010

    I need to be able to copy rows from 1 workbook/sheet to another, based on criteria met in multiple columns. the data needs to copy across clean, no breaks in rows

    for example:

    I have a spreadsheet filled with data, across columns A to Z. In columns B, E and F, I want to be able to specify a criteria. If that criteria is met, I want to copy the rows across to another workbook/sheet.

    Any help would be most appreciated. I have been searching for examples, but cant get my head round it!!

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: copy complete rows based on criteria of cells

    I would suggest that you use a helper column (e.g. column AA) with a formula which looks at columns B E and F for each record, to see if the record matches the criteria, and if it does then the formula should return a unique sequential number. It is then fairly easy to retrieve all the data for that record on another sheet using an INDEX/MATCH formula in conjunction with the ROWS function.

    If you want a more specific answer, it would help if you attached a sample Excel workbook.

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post. Don't try to use the Paperclip icon (Attachments button), as it does not work on this forum.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    12-09-2018
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: copy complete rows based on criteria of cells

    Hi Pete,

    Thanks for your reply, happy new year to you (and all)

    Sorry its taken me awhile to get back. I have uploaded a example spreadsheet. I need to the data to copy over to sheet2 (dashboard) based on criteria.

    For example:
    I want to copy all the data from 'Data' sheet where name = Bob and status = active. But I only want to copy of certain columns, Name; status; comments

    I hope I have attached the spreadsheet correctly!

    Thanks for your help,

    Monty
    Attached Files Attached Files

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: copy complete rows based on criteria of cells

    Hi Monty,

    Happy New Year to you as well.

    I've taken a slightly different approach in the attached file to give you what you are asking for.

    First of all, I have compiled a unique list of names in column H of the Dashboard sheet, and called this list Names. This allows me to use cell C1 on that sheet to select a name using the Data Validation drop-down.

    Then I put this formula in H2 of the Data sheet:

    =IF(AND(B2=Dashboard!$C$1,C2="active"),MAX(H$1:H1)+1,"-")

    This can be copied down as far as you like (I've copied to row 35, as the hyphens indicate), and it will identify each record that matches the criteria and allocate a unique sequential number to each matching record. You could, of course, put the formula in any column that suits (e.g. column AA in your real file).

    Then I used this formula in cell A4 of the Dashboard sheet:

    =IFERROR(INDEX(Data!B:B,MATCH(ROWS($1:1),Data!$H:$H,0))&"","")

    and this can be copied across into cells B4 and C4 - the column reference shown in red will change to C:C in B4 and to D:D in C4, but you will need to change the reference to G:G in C4 as that is where the comments are stored in the Data sheet (you will notice that I've made up some comments in the data sheet). Then you can copy those three formulae down as far as you need to (I've copied to row 15 in the attached file).

    Then you can just select a new name in cell C1 and the data will automatically adjust to show the active records for that person.

    Hope this helps.

    Pete
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-09-2018
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: copy complete rows based on criteria of cells

    Hi Pete,

    Thank you for this. Its just what I was looking for. I will look to implement this into my own spreadsheet.

    All the best,

    Monty

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: copy complete rows based on criteria of cells

    That's good to hear.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark this thread as SOLVED.

    Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

  7. #7
    Registered User
    Join Date
    12-13-2019
    Location
    South Africa
    MS-Off Ver
    Office 365
    Posts
    1

    Re: copy complete rows based on criteria of cells

    Hi,

    I've tried your formula and it works great, tx for this.

    However I did notice it brings in alot of blanks at the end of the copied data.

    Is there a way to stop the formula from adding all the blanks at the end?

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,704

    Re: copy complete rows based on criteria of cells

    Don't copy the formulae down further than you need.

    You should read the Forum Rules (at the top of the screen) and note that you should not try to hijack some-one else's thread (Rule 04). Instead, you should start your own thread, with a link back to this one if you feel it is relevant.

    Pete

  9. #9
    Registered User
    Join Date
    03-12-2020
    Location
    Pune India
    MS-Off Ver
    2020
    Posts
    2

    Re: copy complete rows based on criteria of cells

    I want to download the attached excel. I have registered. But still I can not download attached file.

  10. #10
    Registered User
    Join Date
    03-12-2020
    Location
    Pune India
    MS-Off Ver
    2020
    Posts
    2

    Re: copy complete rows based on criteria of cells

    I could download the file.
    Thanks!

+ 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] Retrieving complete rows of data based on 2 criteria
    By frigyes.hausz in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-29-2016, 10:43 AM
  2. Replies: 2
    Last Post: 10-10-2015, 02:22 AM
  3. Copy complete rows matching criteria to another sheet automatically
    By abdulahadzafar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2014, 12:09 PM
  4. If Statement - to copy complete row based a criteria of one cell in row
    By chloesnowling in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-09-2013, 06:59 AM
  5. Copy and Paste Rows based on Criteria onto another sheet and sort based on oldest item
    By Kushal8684 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2013, 05:37 AM
  6. [SOLVED] Insert rows based on a number and copy complete row
    By prashantsd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-26-2012, 10:41 AM
  7. Replies: 5
    Last Post: 06-08-2012, 11:26 PM

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