+ Reply to Thread
Results 1 to 11 of 11

Copy Columns based on multiple criteria

  1. #1
    Registered User
    Join Date
    06-18-2013
    Location
    sc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Copy Columns based on multiple criteria

    Hello,

    I would like some help regarding the following:

    I have a sheet call "PO_Status" which has several columns, I need to copy columns based on certain text (Active) in column F and multiple text in column D (Network, Server, Rack.ect...)

    I want the condition to met as following :

    IF column F has text (Active) and any of texts in column D then will be copied to an other sheet call Active_sheet.

    I have the following code which is not working good.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Copy Columns based on multiple criteria

    you should be posting this in VBA section not general section

    why you using Row if you want to copy column?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    06-18-2013
    Location
    sc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copy Columns based on multiple criteria

    Hello humdingaling,

    Sorry did not see the VBA section, I hope mod can move it.

    I am using rows because I am interests to copy the rows. Not the columns. I see your point and I hope there is a better code, as the loop for mine is too long.

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Copy Columns based on multiple criteria

    can you provide sample data sheet so i dont have to data entry to replicate
    also which bit is actually not "working good"?
    is the if statement not working?

  5. #5
    Registered User
    Join Date
    06-18-2013
    Location
    sc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copy Columns based on multiple criteria

    attached is a sample data

    The IF Statement does not work correctly it would not look for all the condition... main thing here is to have IF "Active" and any other words from column D I specify meet then will copy the rows to other sheet.

    Thx
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Copy Columns based on multiple criteria

    Please Login or Register  to view this content.
    Don't think you can use OR the way you are using it
    also INSTR function as you are not doing exact match
    if string exist it would give a number so if number is greater than 0 then if loop is executed

    i separated your "active" loop so make it easier to follow
    Last edited by humdingaling; 06-18-2013 at 11:42 PM.

  7. #7
    Registered User
    Join Date
    06-18-2013
    Location
    sc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copy Columns based on multiple criteria

    This work nice. However, is there any way we can make it case- sensitive or exact match, for example: if I have "Server" and other Cell has "Server 1" it will pull both rows while I am only calling for cell with exact "Server"

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Copy Columns based on multiple criteria

    Please Login or Register  to view this content.
    this line will pick up if cell contains "network"
    is equal to "Server" ie server 1 is skipped
    or contains "rack"

    reason i used instr is because in your example you wanted Network to be picked up but in the cell it is network devices
    i assumed there was other cells network "BLAH"

  9. #9
    Registered User
    Join Date
    06-18-2013
    Location
    sc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copy Columns based on multiple criteria

    Thank you very much for your help, this is just a small part of a long code. I only used

    Please Login or Register  to view this content.
    Thank you again, I owe you a beer

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Copy Columns based on multiple criteria

    not a problem, well you know how to use instr now if you should need it

    glad to help

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  11. #11
    Registered User
    Join Date
    06-18-2013
    Location
    sc
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Copy Columns based on multiple criteria

    done,
    Thx

+ 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