+ Reply to Thread
Results 1 to 8 of 8

Counting the number of entries by lotid

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Counting the number of entries by lotid

    I have a sheet see enclosed.

    What i want is two cols for the output.
    Lotid and Percentage

    So, for a given lotid i want to count =>
    (number of No Errors)/ (number_of_errors + number_of_No_Errors)

    Notice that in the file there are multiple entries for a given lotid. But what i want is as i said above

    For a single lotid (so need to generate a unique list of lotids) count
    (number of No Errors)/ (number_of_errors + number_of_No_Errors)
    Attached Files Attached Files
    Last edited by welchs101; 06-02-2011 at 06:19 AM.

  2. #2
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Counting the number of entries by lotid

    i used a technique from an earlier post that someone gave me and it works as well. see enclosed file.

    One question i did have is how to get the unique list of lotids. What i did was use the advanced filter option to create a unique list. Is this the best most efficient way? This way is "manual".....is there a more "automatic method". If not thats ok.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Counting the number of entries by lotid

    here is the table with the percentages
    Attached Files Attached Files

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Counting the number of entries by lotid

    If you want unique values then...

    The sum is not necessary with the Countifs in this scenario
    Attached Files Attached Files
    Last edited by jeffreybrown; 06-01-2011 at 11:05 PM.
    HTH
    Regards, Jeff

  5. #5
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Counting the number of entries by lotid

    thanks!

    Just curious how you came up with the unique list .........did you use the advanced filter option?

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Counting the number of entries by lotid

    You're welcome and yes I used the advance filter. If you trun on the macro recorder and record those actions the recording gives some good code you can repeat over and over.

    Here are a couple of options.

    Sub CreateUniqueList()
        With Sheets("Sheet1")
            .Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).AdvancedFilter _
                Action:=xlFilterCopy, CopyToRange:=.Range("B1"), Unique:=True
        End With
    End Sub
    Sub FilterUnique()
        Dim Rng As Range, Dn As Range
    
        Set Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
        With CreateObject("scripting.dictionary")
            .CompareMode = vbTextCompare
            For Each Dn In Rng
                If Not .Exists(Dn.Value) Then
                    .Add Dn.Value, ""
                End If
            Next
            Range("B1").Resize(.Count).Value = Application.Transpose(.keys)
        End With
    End Sub

  7. #7
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Counting the number of entries by lotid

    thanks for the info! very helpful.


    On another issue related to this post:

    Why did I not have to use the "SUM" on this one and I do have to use the "SUM" on the other one? I am not sure when i would need it and when i would not.

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Counting the number of entries by lotid

    Instead of me searching for it, could you post the formula you are referring too. Thanks

+ 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