+ Reply to Thread
Results 1 to 6 of 6

Determining duplicate entries and frequency

  1. #1
    Registered User
    Join Date
    03-19-2009
    Location
    England
    MS-Off Ver
    Excel 2019
    Posts
    3

    Determining duplicate entries and frequency

    Hi, this is my first post, so i hope i have posted in the correct place.

    I have been using excel for a while now but only for simple spreadsheet applications.

    I have a worksheet which consists of 9 columns of alphanumeric data (columns A - I) which each contains alphanumeric data. Each column may have upto 2000 enteries.

    The data generally consists of an alphanumeric string consisting of no more than 7 characters.

    For example:

    ABC123D
    CDE456F
    DFR789R

    etc

    Each column does have unique strings, however each columns is obvioulsy different.

    Contained within some of the coumns may be some alphanumeric strings which are also present in other columns.

    How would one find a way of establishing what these common strings are in each of the columns and presenting their frequency. It could be the case that a common string only appears in 4 out of the 9 sheets and may consist of more than one common string.

    So for example in column M I would like to present on the duplicate strings which are present in the columns along with their respective frequency of occurance.

    For example.

    ABC123D - 5
    CEF543E - 3

    And so on.

    Any help would be greatfully appriciated as this is a bit beyond me.

    Steve

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    re: Determining duplicate entries and frequency

    Countif() counts the number of times a certain string occurs amongst a range.. maybe you can adapt that function? See Excel help on the Countif function for details.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    03-19-2009
    Location
    England
    MS-Off Ver
    Excel 2019
    Posts
    3

    re: Determining duplicate entries and frequency

    Unfortunatly each string within a column length of 2000 enteries is different.

    I guess this command is easy to use if you only want to count 1 or 2 known strings within the range.

    I need to find out which strings are common (and their frequency) against 9 columns each consisting of around 2000 enteries. So finding possibily multiple duplicates in around 18000 enteries.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    re: Determining duplicate entries and frequency

    This is an ugly macro, but it works, run it and stretch, it would probably take a minute or more on that much data:
    Please Login or Register  to view this content.
    The result will be Column M has items with duplicates, column N has the frequency count of those duplicates.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    re: Determining duplicate entries and frequency

    Say your 9-column range is A1:I2000

    In M1, put formula:

    =IF(COUNTIF($A$1:$I$2000,A1)>1,A1,"")

    copy it across 9 columns and down to row 2000.

    If you have duplicates it will show you what is it and exactly where it is.

    Or if you just want total counts, use:

    =COUNTIF($A$1:$I$2000,A1) anything greater that 1 is duplicated.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    re: Determining duplicate entries and frequency

    Hello Tissy,

    Here is another option. This macro will return a list of the duplicates with their frequency (2 or higher). It will work with all types of cell data, except cells that my contain arrays. It has been setup to look at cells "A1:I2000" on "Sheet1" and put list on "Sheet2" starting with cell "A1". You can change the location of the data and duplicate list. They are marked in red in the code.
    Please Login or Register  to view this content.
    Adding the Macro
    1. Copy the macro above pressing the keys CTRL+C
    2. Open your workbook
    3. Press the keys ALT+F11 to open the Visual Basic Editor
    4. Press the keys ALT+I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Paste the code by pressing the keys CTRL+V
    7. Make any custom changes to the macro if needed at this time.
    8. Save the Macro by pressing the keys CTRL+S
    9. Press the keys ALT+Q to exit the Editor, and return to Excel.

    To Run the Macro...
    To run the macro from Excel, open the workbook, and press ALT+F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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