+ Reply to Thread
Results 1 to 12 of 12

Find doubles in a column and copy them to a seperate place

  1. #1
    Registered User
    Join Date
    12-18-2018
    Location
    Switzerland
    MS-Off Ver
    MS Office 2007
    Posts
    5

    Find doubles in a column and copy them to a seperate place

    Hi I have the following problem in Excel:

    I want to find text doubles in a column and then automatically copy the information of that row to a another, seperate table. This second table then will only contain the doubles.

    This is how my table looks now:


    NAME PRODUCT ID
    John Apples 112
    Marc Apples 113
    Irene Oranges 114


    In this case I would like to copy out the information of Marc and John, because they have the same product. I'm sure there is a relativley easy solution to this problem but i was not able to find one. What would you guys propose? Thanks in advance!

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Find doubles in a column and copy them to a seperate place

    A VBA solution will work?
    To copy the unique rows based on criteria on column B to Sheet2:
    Please Login or Register  to view this content.
    To copy the rows based on duplicates in column B to Sheet3:
    Please Login or Register  to view this content.
    To copy the duplicated rows to Sheet3 and remove them from Sheet1(I've used Sheet one for the data):
    Please Login or Register  to view this content.
    Click the * to say thanks.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Find doubles in a column and copy them to a seperate place

    or a formula:

    =IFERROR(INDEX(A:A,SMALL(INDEX((COUNTIF($B$2:$B$8,$B$2:$B$8)=1)*10^10+ROW($B$2:$B$8),0),ROWS(E$2:E2))),"")

    in E2, copied across and down. You may need ; instead of ,
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    12-18-2018
    Location
    Switzerland
    MS-Off Ver
    MS Office 2007
    Posts
    5

    Re: Find doubles in a column and copy them to a seperate place

    Thank you both so much! Glenn I tried your solution because it's a bit easier for me and it works. Is there a way to order the result in the table? So that the outcome is all apples first, then all peaches etc..?

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Find doubles in a column and copy them to a seperate place

    that does make it more complicated!!

    In E2, copied down (and copy pasted into G2)

    =IFERROR(INDEX(A:A,SMALL(IF($B$2:$B$8=$F2,ROW($B$2:$B$8)),COUNTIF($F$2:$F2,$F2))),"")

    in F2:
    =IFERROR(INDEX($B$2:$B$8,MATCH(1/(1/LARGE((COUNTIF($B$2:$B$8,">="&$B$2:$B$8)*(COUNTIF($B$2:$B$8,$B$2:$B$8)<>1)),ROWS($1:1))),(COUNTIF($B$2:$B$8,">="&$B$2:$B$8)*(COUNTIF($B$2:$B$8,$B$2:$B$8)<>1)),0)),"")

    These are ALL array formulae.


    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-18-2018
    Location
    Switzerland
    MS-Off Ver
    MS Office 2007
    Posts
    5

    Re: Find doubles in a column and copy them to a seperate place

    thanks, it's working. However if I try to expand the code on more rows (for example from 1 to 1000), a lot of values stay empty. So it now looks like this:

    Name Product ID
    John Apple 111
    Apple
    Apple
    Irene Peaches 119
    Peaches

    Any idea why that could be?

    I use the code:

    in H =IFERROR(INDEX(B:B,SMALL(IF($E$2:$E$1000=$I2,ROW($E$2:$E$1000)),COUNTIF($I$2:$I2,$I2))),"")

    in I =IFERROR(INDEX($E$2:$E$1000,MATCH(1/(1/LARGE((COUNTIF($E$2:$E$1000,">="&$E$2:$E$1000)*(COUNTIF($E$2:$E$1000,$E$2:$E$1000)<>1)),ROWS($1:1))),(COUNTIF($E$2:$E$1000,">="&$E$2:$E$1000)*(COUNTIF($E$2:$E$1000,$E$2:$E$1000)<>1)),0)),"")

    in J =IFERROR(INDEX(F:F,SMALL(IF($E$2:$E$1000=$I2,ROW($E$2:$E$1000)),COUNTIF($I$2:$I2,$I2))),"")

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Find doubles in a column and copy them to a seperate place

    Post an updated spreadsheet. If the above is your INPUT rather than your output, it is a totally different question !!

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Find doubles in a column and copy them to a seperate place

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

  9. #9
    Registered User
    Join Date
    12-18-2018
    Location
    Switzerland
    MS-Off Ver
    MS Office 2007
    Posts
    5

    Re: Find doubles in a column and copy them to a seperate place

    here is what I have:
    Attached Files Attached Files

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Find doubles in a column and copy them to a seperate place

    From H4 downwards, you had upset the array and the {} had gone. I have also added a tweak to stop the 0s from appearring.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    12-18-2018
    Location
    Switzerland
    MS-Off Ver
    MS Office 2007
    Posts
    5

    Re: Find doubles in a column and copy them to a seperate place

    solved the problem, thanks a lot

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Find doubles in a column and copy them to a seperate place

    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

+ 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] Find certain column, copy it and paste into seperate sheet
    By emily_k8_lewis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-02-2013, 08:59 AM
  2. [SOLVED] place text seperated by a space in a column into seperate columns
    By Markus L in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 12:05 PM
  3. place text seperated by a space in a column into seperate columns
    By Markus L in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 07:05 AM
  4. place text seperated by a space in a column into seperate columns
    By hobiedog in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  5. [SOLVED] place text seperated by a space in a column into seperate columns
    By hobiedog in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  6. [SOLVED] place text seperated by a space in a column into seperate columns
    By hobiedog in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. place text seperated by a space in a column into seperate columns
    By hobiedog in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  8. place text seperated by a space in a column into seperate columns
    By hobiedog in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-27-2005, 12:05 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