+ Reply to Thread
Results 1 to 18 of 18

count the duplicate entries with the help of Macro

Hybrid View

  1. #1
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: count the duplicate entries with the help of Macro

    Maybe :

    Sub Test()
      Dim coll As New Collection, arrIn, arrOut, i As Long, p As Long, v1, v2
    
      arrIn = Sheet1.Range("A1").CurrentRegion.Value
      For i = 2 To UBound(arrIn, 1)
          On Error Resume Next
             coll.Add key:=arrIn(i, 2), Item:=Array(arrIn(i, 2), New Collection)
          On Error GoTo 0
          coll(arrIn(i, 2))(1).Add arrIn(i, 3)
      Next i
    
      ReDim arrOut(1 To UBound(arrIn, 1), 1 To 4)
      p = 1: arrOut(p, 1) = "SYMBOL": arrOut(p, 2) = "COUNT": arrOut(p, 3) = "SYMBOL": arrOut(p, 4) = "DATE"
      For Each v1 In coll
          arrOut(p + 1, 1) = v1(0)
          arrOut(p + 1, 2) = v1(1).Count
          i = 0
          For Each v2 In v1(1)
              p = p + 1
              i = i + 1
              arrOut(p, 3) = v1(0) & "-" & Application.WorksheetFunction.Roman(i)
              arrOut(p, 4) = v2
          Next v2
      Next v1
    
      Columns("L:O").ClearContents
      Range("L1").Resize(UBound(arrOut, 1), UBound(arrOut, 2)).Value = arrOut
    End Sub
    Attached Files Attached Files
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

+ 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] Formula to Count Duplicate entries in Data Range
    By kenadams378 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-30-2014, 11:16 AM
  2. [SOLVED] Count no. of data in a range, counting duplicate entries once
    By Rianne in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-12-2013, 12:31 AM
  3. [SOLVED] Count duplicate text entries and ignore errors
    By raaz00 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-03-2012, 01:41 PM
  4. count duplicate entries in column
    By khilari in forum Excel General
    Replies: 3
    Last Post: 04-17-2006, 04:56 PM
  5. How do I count a row of NON-duplicate entries in Excell?
    By needhelp in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-20-2005, 02:06 PM
  6. [SOLVED] count duplicate (or, inversely, unique) entries, but based on a condition
    By markx in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-08-2005, 03:06 PM

Tags for this Thread

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