+ Reply to Thread
Results 1 to 12 of 12

Counting TYPES of duplicates

  1. #1
    Registered User
    Join Date
    05-21-2014
    Posts
    59

    Counting TYPES of duplicates

    I have a dataset that has a good number of duplicates, many of which have more than 2 records.

    In these sets of duplicates, there are two fields that have many combinations of values.

    I would like to find a way to COUNT THE COMBINATIONS in all of the sets of duplicates, as in, every time there is a type of a certain combination of values, create a count for it:

    12345 9 9
    12345 9 0

    123456 9 9
    123456 9 0

    (Total: 2) For 9/9 and 9/0

    12344567 0 0
    12344567 0 0
    12344567 0 0

    12344567 0 0
    12344567 0 0
    12344567 0 0

    (Total: 2) For 0/0 3x

    I have attached a listing of types of combinations that I found by scanning the database, but I don't know what formula or functions would do the trick. I don't think there is something in Subtotal or the Count functionalities that would apply but I will fumble around.

    Any help would be appreciated.

    Dan B
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Counting TYPES of duplicates

    It might be easier if you posted a small subset of the source data. Also, can you explain exactly what you mean by "(Total: 2) For 0/0 3x" after
    12344567 0 0
    12344567 0 0
    12344567 0 0

    12344567 0 0
    12344567 0 0
    12344567 0 0

    I can see why that would be 1 (there are 6 replicates of ONE code), but not why there would be 2? Is it because each group of 3 cells is counted as a separate item??
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Counting TYPES of duplicates

    It isn't clear what you are trying to achieve. It might be worth explaining what the numbers mean and therefore what the matches mean.


    click on the * Add Reputation if this was useful or entertaining.

  4. #4
    Registered User
    Join Date
    05-21-2014
    Posts
    59

    Re: Counting TYPES of duplicates

    Tony and Glenn:


    1) Glenn: your second question is correct; each record is a duplicate, based on the same ACCIDENT NUMBER (i.e., 12345, 12344567, 123456, etc).

    Ok, I admit, I probably should have indicated the duplicates are based on the ACCIDENT Number.

    2) I want to count the TYPES of combinations of duplicates. I even thought of making a comma-delimited file to do this but don't know how. For example:

    12345, 9,0,9,0 (ACCIDENT_NUM 12345, Type 1 -- 2 sets of 9 killed, 0 injured)
    123456, 01,0,1,0,1 (ACCIDENT_NUM 123456, Type 2 --3 sets of 9 killed, 1 injured)

    Also:

    1234567, 0,1,0,2 (Type 3--ACCIDENT_NUM 1234567, 1 record of 0 killed, 1 injured, 1 record of 0 killed, 2 injured)
    12345678, 0,1, 0,1, 0,0 (Type 4--ACCIDENT_NUM 12345678, 2 records 0 killed, 1 injured, 1 record of 0 killed, 0 injured)

    and so on, then do Totals for the whole dataset for Type 1 (Total = 2), Type 2 (Total = 1), Type 3 (Total = 1), Type 4 (Total = 1) and so on.

    ****************

    ALright:

    I know this wasn't a part of the original post, so if you don't want to answer this, no worries, but:

    In addition to counting the TYPES of duplicate scenarios based on ACCIDENT NUM, I also want to:

    1) determine the SEVERITY
    (IF K > 0 then Severity = K,
    IF I > 0 and K, then Severity = I,
    IF K and I = 0 then Severity = K
    IF K and I = 0, then Severity = PDO)

    2) Once SEVERITY has been determined, delete all other records that don't determine Severity.

    There is an error in one of the sets of records because I sense that there are 2 sets of duplicates (!) within another??


    GRRRRRRRRRRRRRRRR.



    I have attached a file that indicates how I ultimately would like things to look.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-21-2014
    Posts
    59

    Re: Counting TYPES of duplicates

    Tony and Glenn:

    Maybe this will work:

    How would I:

    1) GROUP sets of values together,

    2) Create a "Pattern" number (label?) based on the Pattern

    3) Do a Count of the Pattern Types in the whole spreadsheet/database?


    ACCIDENT NUM KILLED INJURED PATTERN COUNT

    12345 0 0
    12345 0 0
    12345 0 0 1 1

    123456 0 0
    123456 0 0 2 1

    123345 0 0
    123345 0 0 2 2

    1235456 0 0
    1235456 0 0
    123456 0 0 1 2

    123444 1 1
    123444 1 1 3 1

    1234445 0 0
    1234445 0 0 2 3


    How would I create a Pattern Number (PATTERN FIELD)?

    In other words, Pattern 1 = 0,0 (3x), Pattern 2 = 0,0 (2x), Pattern 3 = 1,1 (2x), and so on...and Count = SUM of Number of times for Pattern 1, Pattern 2, Pattern 3....

    How could I use GROUP to Group the values in KILLED and INJURED and have it equal Pattern 1, Pattern 2, etc...?

    (Count is something I'll need but its probably simple enough, I would think, Yes? TOTAL of Patterns in Pattern Field, like =SUM("1",B2:B5, SUM("2",B2:B5), etc.

    I could send a database if needbe but the main thing is what is the procedure involved---functions et al.

    Dan B

  6. #6
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Counting TYPES of duplicates

    I am still puzzled by the data. I need a clear description of the data before I can look at the solution.

    An example of my puzzlement:
    12345, 9,0,9,0 (ACCIDENT_NUM 12345, Type 1 -- 2 sets of 9 killed, 0 injured)
    123456, 01,0,1,0,1 (ACCIDENT_NUM 123456, Type 2 --3 sets of 9 killed, 1 injured)


    So is Type1 because it is the first line, or because the first part is 5 digits or because it has 4 numbers following.
    do blank lines have a particular significance.
    It appears that the line consists of a single reference number followed by number pairs. What od each of these pairs mean. Is there a maximum number of pairs.
    IS the analysis based on a single line or are the lines grouped (if so how).
    Is any significance based on the length of the reference number. Are references with the same prefix related eg 11111 and 111112

    Once you have done that it would be helpful to understand the purpose of the analysis.

    It would also be interesting to know what the business purpose is? t helps to keep the interest.

  7. #7
    Registered User
    Join Date
    05-21-2014
    Posts
    59

    Re: Counting TYPES of duplicates

    Tony:

    DISREGARD the earlier post. Today's post should be more clear as to what I need.

    The Accident Num field entries are just RANDOM numbers I threw together to create IDs, they don't have any prefixes or whatever, so don't worry if there are 5 digits in one and 7 digits in another; the main thing is that there are Duplicates--they are groups but the real groups (sequences of values) we want to focus on are the figures in the Killed and Injured fields.

    I only used Blank Lines to separate the groups of duplicates; the Master database doesn't have blank lines. Will this be a problem?

    This project is for a Google Earth-based application showing the distribution of accidents on a highway network. Please keep this confidential.

    Thank you,

    Dan

  8. #8
    Registered User
    Join Date
    01-06-2014
    Location
    Columbus, IN
    MS-Off Ver
    2013/O365
    Posts
    41

    Re: Counting TYPES of duplicates

    Quote Originally Posted by DannyGIS View Post
    This project is for a Google Earth-based application showing the distribution of accidents on a highway network. Please keep this confidential.

    Thank you,

    Dan
    You posted not only ON THE INTERNET but on a publicly searchable (and frequently searched) forum and you're asking us to keep it confidential?
    -Russell

  9. #9
    Registered User
    Join Date
    05-21-2014
    Posts
    59

    Re: Counting TYPES of duplicates

    ASK TONY H about why he was asking me?

    How anonymous and generic is a "collision database"? I shouldn't have to even mention stuff like that, but if I'm being asked, I'm not running away from it.

    Why don't you ask yourself why you have to be concerned?

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

    Re: Counting TYPES of duplicates

    I'm going to step in and request you all moderate yourselves here. It is very easy for simple Q&A to devolve accidentally into unnecessary disagreement or argument. Everything about this thread is fine, so let's get back on topic.

    Now that everyone is clear about what the data represents and a generic sense of what it's for, time to get back to the OP's need, ok all?
    _________________
    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!)

  11. #11
    Registered User
    Join Date
    05-21-2014
    Posts
    59

    Re: Counting TYPES of duplicates

    J:

    Thank you big time for saying what you said. The poster who went so far as to ask what this was about was perfectly fine asking but I honestly didn't want to go much further saying what I did, because I knew too well that if I did reveal more specifics it could have led to dangerous curves ahead, such as what the other poster was wondering about as to why I was posting what I did. Maybe there should be a restriction on how far people can go along these lines and whether or not they have the option as to how much they should reveal about their projects.

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

    Re: Counting TYPES of duplicates

    No rules are necessary on this. People know how much they should and should not say about their projects. And our helpers need to know what they need to know to wrap their heads around the puzzles being presented. 95% these needs are compatible, but on a rare occasion they are not.

    The only trick here is to make sure you do not end up in an argument over that fact. That's on you guys.

+ 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] VBA to Find 4 types of Duplicates with multiple criteria
    By Jul Stev in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-30-2013, 12:28 AM
  2. [SOLVED] Not counting all types of products
    By BBoyAl in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-01-2012, 03:47 PM
  3. Counting types of OR cases by month
    By Research RN in forum Excel General
    Replies: 5
    Last Post: 11-19-2008, 07:24 PM
  4. Counting Cells between three Types
    By Sultix in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-01-2007, 12:13 PM
  5. COUNTING 3 DIFFERENT TYPES OF DATA FROM A RANGE
    By john.9.williams@bt.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-01-2006, 07:10 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