Results 1 to 4 of 4

Counting duplicates except rows with specific data

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-31-2012
    Location
    Los Angeles, USA
    MS-Off Ver
    2003, 2010, 365
    Posts
    323

    Counting duplicates except rows with specific data

    Hi,

    I have attached the excel 2003 file complete with the below VBA and data to be changed, the VBA below works and currently counts the duplicates in Column A and applies the values based on Column C but when I have specific data in column I such as MPL002C 2 of 3 or 'MPL002C 3 of 3 then I do not want it to count those rows.

    Sub Test()
    '
    '
    
        Dim dic As Object, a, x, i As Long
        Set dic = CreateObject("Scripting.Dictionary")
        dic.CompareMode = 1
        dic("Test1") = VBA.Array(6, 6, 0)
        dic("Test2") = VBA.Array(2.5, 2.5, 0)
        dic("Test3") = VBA.Array(2.5, 2.5, 5, 10, 15)
        With Range("a2", Range("a" & Rows.Count).End(xlUp)).Resize(, 3)
            a = .Value
            x = .Parent.Evaluate("if(row(" & .Columns(1).Address & "),countif(" _
            & .Columns(1).Address & "," & .Columns(1).Address & "))")
            For i = 1 To UBound(a, 1)
                If dic.exists(a(i, 3)) Then
                    x(i, 1) = Application.Min(x(i, 1) - 1, UBound(dic(a(i, 3))))
                    a(i, 1) = dic(a(i, 3))(x(i, 1))
                Else
                    a(i, 1) = ""
                End If
            Next
            .Columns("h").Value = a
        End With
        
    End Sub
    Could anybody please help with this, I know its not easy but any help is appreciated.


    David
    Attached Files Attached Files
    Last edited by djfscouse; 10-29-2013 at 04:55 PM. Reason: change attachment so it has example expected output

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Counting Duplicates - Displaying Results with Specific Criteria
    By VegasL in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-27-2013, 04:19 PM
  2. [SOLVED] Counting data duplicates across columns
    By sahsinha in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-24-2013, 02:12 PM
  3. Copying rows from 1 worksheet to another with specific criteria and no duplicates
    By jennys83 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2012, 09:30 AM
  4. counting cells with data without counting duplicates
    By labettis in forum Excel General
    Replies: 2
    Last Post: 11-05-2007, 12:10 PM
  5. Counting rows with specific criteria
    By sulrich in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2005, 02:13 PM

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