+ Reply to Thread
Results 1 to 9 of 9

Create list of duplicates based on occurances in another list

  1. #1
    Forum Contributor
    Join Date
    07-19-2010
    Location
    Huddersfield, UK
    MS-Off Ver
    Excel 2007, 2010
    Posts
    167

    Create list of duplicates based on occurances in another list

    Having tried many search terms I cannot find anything that is similar to my problem, so I'm hoping someone can help!

    Eng list.xlsx

    The attached file (a copy of my main one) has a list of our engineers, and what stock they carry. The stock parts are the 64, 65, 66... numbers.

    I need to create a list from this (as underneath the main table), for all instances where there is a 'Y' in the columns next to each engineer. So if an engineer has 3x pieces of stock, they need to appear in the list 3x times. If they have 1x piece of stock, they appear in the list once.

    I hope that makes sense...!
    Last edited by dancing-shadow; 05-27-2014 at 07:20 AM.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Create list of duplicates based on occurances in another list

    With this code.

    After that you can filter on column C in sheet output.

    See the attached file.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Create list of duplicates based on occurances in another list

    Or, with a couple of array formulas**:

    In A14:

    =IF(ROWS($1:1)>COUNTIF($E$4:$I$7,"Y"),"",INDEX($A$4:$A$7,MATCH(TRUE,MMULT(0+(ROW($A$4:$A$7)>=TRANSPOSE(ROW($A$4:$A$7))),COUNTIF(OFFSET($E$4:$I$4,ROW($A$4:$A$7)-MIN(ROW($A$4:$A$7)),,,),"Y"))>=ROWS($1:1),0)))

    In B14:

    =IF(E14="","",INDIRECT(TEXT("3000"&RIGHT(SMALL(IF($E$4:$I$7="Y",10^6*ROW($E$4:$I$7)+COLUMN($E$4:$I$7)),ROWS($1:1)),3),"R000000C000000"),0))

    Copy both down until you start to get blanks.

    Note that the "3" in the "3000" in the second formula should match the row number equivalent to that of the top row of your table.

    Regards


    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Last edited by XOR LX; 05-27-2014 at 06:12 AM.
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  4. #4
    Forum Contributor
    Join Date
    07-19-2010
    Location
    Huddersfield, UK
    MS-Off Ver
    Excel 2007, 2010
    Posts
    167

    Re: Create list of duplicates based on occurances in another list

    Many thanks to both of you for the fast responses!

    The formula from XOR is more what I'm after, and I have got this to work just as you have stated in A14 and B14. I would like, however, to put this list in A2 and B2 on Sheet2. I have tried cutting and pasting to preserve the referencing, but column B now shows 0's... Can you advise?

    I'm also wondering what the significance of ...(TEXT("3000"... and "R000000C000000" is please?

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Create list of duplicates based on occurances in another list

    Can you re-post the attachment with your attempt at moving the formulas?

    Regards

  6. #6
    Forum Contributor
    Join Date
    07-19-2010
    Location
    Huddersfield, UK
    MS-Off Ver
    Excel 2007, 2010
    Posts
    167

    Re: Create list of duplicates based on occurances in another list


  7. #7
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Create list of duplicates based on occurances in another list

    Thanks. Your (array) formula in Sheet2 A2 should be:

    =IF(ROWS($1:1)>COUNTIF(Sheet1!$E$4:$I$7,"Y"),"",INDEX(Sheet1!$A$4:$A$7,MATCH(TRUE,MMULT(0+(ROW(Sheet1!$A$4:$A$7)>=TRANSPOSE(ROW(Sheet1!$A$4:$A$7))),COUNTIF(OFFSET(Sheet1!$E$4:$I$4,ROW(Sheet1!$A$4:$A$7)-MIN(ROW(Sheet1!$A$4:$A$7)),,,),"Y"))>=ROWS($1:1),0)))

    And that in B2:

    =IF(A2="","",INDIRECT("'Sheet1'!"&TEXT("3000"&RIGHT(SMALL(IF(Sheet1!$E$4:$I$7="Y",10^6*ROW(Sheet1!$E$4:$I$7)+COLUMN(Sheet1!$E$4:$I$7)),ROWS(Sheet1!$1:1)),3),"R000000C000000"),0))

    Regards

  8. #8
    Forum Contributor
    Join Date
    07-19-2010
    Location
    Huddersfield, UK
    MS-Off Ver
    Excel 2007, 2010
    Posts
    167

    Re: Create list of duplicates based on occurances in another list

    That works perfectly, many many thanks

  9. #9
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Create list of duplicates based on occurances in another list

    You're welcome!

+ 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. Replies: 14
    Last Post: 01-28-2014, 01:45 PM
  2. How to create drop down list in Excel where each list item is based on two columns?
    By matkiros in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2012, 08:50 AM
  3. Replies: 5
    Last Post: 08-26-2008, 01:07 PM
  4. filter list of duplicates to create new list
    By DaveNEC in forum Excel General
    Replies: 4
    Last Post: 05-08-2008, 07:54 AM
  5. Create list based on Pivot Page Field List
    By Macdave_19 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2008, 09:40 AM

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