+ Reply to Thread
Results 1 to 5 of 5

Extract repeated data from a range

  1. #1
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Extract repeated data from a range

    I have a range of data where I want to extract all items that exist more than one time. In the example below is that only one item (OBRAUT). Any idea about a good function or VBA-code I can use. Input data can be in column A and output data in column B.

    Please Login or Register  to view this content.
    Last edited by mkvassh; 05-05-2010 at 09:15 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Extract repeated data from a range

    Formula wise... if you assume your sample values are in Column A

    C1:
    =SUMPRODUCT((A1:A100<>"")*(COUNTIF(A1:A100;A1:A100&"")>1))/2

    The above gives you count of duplicate terms - thereby allowing you to limit the no. of times you look for duplicated values

    B1:
    =IF(ROWS(B$1:B1)>$C$1;"";INDEX($A$1:$A$22;MATCH(1;INDEX(($A$1:$A$22<>"")*(COUNTIF($A$1:$A$22;$A$1:$A$22&"")>1);0);0)))
    copied down

    EDIT: the formula in C1 is not valid... I will post back a revision (see below)

    C1:
    =SUMPRODUCT((A1:A100<>"")*((COUNTIF(A1:A100,A1:A100&"")>1)/COUNTIF(A1:A100,A1:A100&"")))

    probably a better way to calc this though...
    Last edited by DonkeyOte; 05-05-2010 at 07:19 AM. Reason: added (see below) to reduce confusion

  3. #3
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Re: Extract repeated data from a range

    It does not work properly yet. If I have two duplicates in the range will the function return only one of them. See attached file.
    Attached Files Attached Files

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Extract repeated data from a range

    Sorry - I didn't think that one through quite as well as I should have !

    First - insert a blank header row - ie insert a row into the sheet such that A1:C1 etc are all blank and present formulae have moved to row 2

    Then modify B2 to be:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-02-2007
    Location
    Bryne, Norway
    MS-Off Ver
    Microsoft Office Excel 2010
    Posts
    230

    Re: Extract repeated data from a range

    Thank you :-) Appreciate it a lot

+ 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