+ Reply to Thread
Results 1 to 11 of 11

count duplicates

Hybrid View

loade count duplicates 05-03-2012, 04:12 AM
zbor Re: count duplicates 05-03-2012, 04:14 AM
loade Re: count duplicates 05-03-2012, 11:42 AM
Marcol Re: count duplicates 05-03-2012, 12:10 PM
WHER Re: count duplicates 05-03-2012, 04:31 PM
loade Re: count duplicates 05-03-2012, 04:21 PM
loade Re: count duplicates 05-03-2012, 04:55 PM
WHER Re: count duplicates 05-03-2012, 05:19 PM
loade Re: count duplicates 05-03-2012, 05:22 PM
WHER Re: count duplicates 05-03-2012, 05:50 PM
Marcol Re: count duplicates 05-03-2012, 06:08 PM
  1. #1
    Registered User
    Join Date
    04-01-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    42

    count duplicates

    hello!

    in a list of duplicate rows, I want to count the duplicates of each different row, like in the below:
    Book3.xls

    how can I do this?

    thanks!

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,058

    Re: count duplicates

    Here, try this in F7:

    =SUMPRODUCT(--($A$1:$A$300=D7),--($B$1:$B$300=E7))
    Never use Merged Cells in Excel

  3. #3
    Registered User
    Join Date
    04-01-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: count duplicates

    I want it to be independent of the amount of rows
    also, independent of the length of each row (so it should display below the last row)

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: count duplicates

    See the formulae in this workbook, drag the table whereever you want.

    Note.
    D7 is different to D8, D8 can be dragged.

    This just adds to what zbor stated.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: count duplicates

    One more, UDF approach (can be placed anywhere on the worksheet):
    Attached Files Attached Files
    Last edited by WHER; 05-03-2012 at 04:51 PM.

  6. #6
    Registered User
    Join Date
    04-01-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: count duplicates

    is it possible to do it by simply click a button in any xls file?
    ie, by clicking the button, to display that "report" below the last non-empty row?

  7. #7
    Registered User
    Join Date
    04-01-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: count duplicates

    can you tell me the macro code and how to trigger it?
    thanks

  8. #8
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: count duplicates

    It's a User Defined Function (UDF) not a macro, it's not "triggered" but entered like a normal function (e.g. "Sum(A1:A10)").
    In the example it's entered in cell H7, then dragged sideways, then down (or vice versa).
    The code can be found in the attachment: Alt+F11 will open the Visual Basic Editor, then open "Module 1", there you find the code.
    Public Function splt(rng As Range, lng As Long, i As Integer)
    
    Dim arr, str, lng2 As Long, lng3 As Long, dic As Object
    Application.Volatile
    Set dic = CreateObject("Scripting.Dictionary")
    With dic
        For lng3 = 1 To rng.Rows.Count
           str = ""
           str = rng(lng3, 1) & "|" & rng(lng3, 2)
           .Item(str) = .Item(str) + 1
        Next
    arr = Array(.Keys, .Items)
      If i = 1 Then
       splt = Split(arr(0)(lng - 1), "|")(0)
      ElseIf i = 2 Then
       splt = Split(arr(0)(lng - 1), "|")(1)
      ElseIf i = 3 Then
        splt = arr(1)(lng - 1)
      End If
    End With
    End Function

  9. #9
    Registered User
    Join Date
    04-01-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    42

    Re: count duplicates

    thanks but the problem with this is that I need to enter it manually
    while a macro is always there, ready to be triggered
    cant it be assigned somehow to a macro?

  10. #10
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: count duplicates

    It's probably possible to re-think this as a macro, but as explained above, it only needs to be entered in 1 cell (20 seconds worth of typing), then dragged across (another 5 seconds), hardly a "problem"?

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: count duplicates

    thanks but the problem with this is that I need to enter it manually
    while a macro is always there, ready to be triggered
    ....

    “We do the impossible every day. Miracles take a little longer.”

    A little effort goes a long way ...

+ 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