+ Reply to Thread
Results 1 to 5 of 5

counting data

Hybrid View

  1. #1
    Registered User
    Join Date
    06-06-2007
    Posts
    3

    counting data

    hi, im new here, i know very little about excel beyond simple features and dont really know how to prgram VB (though i can do it by example)

    im not really sure how to explain what i would like to do but here goes.

    *i have a huge file containing data relating to levelled steel plate

    *there are two columns i am focusing on. plate ID number and Piece number (there can be many pieces all cut from the same plate)

    *every time a piece passes through the TAB leveller, it gets recorded. lets say it goes through 5 times. it will look like this

    Plate ID Piece No Pass
    jw001 1 forward
    jw001 1 reverse
    jw001 1 forward
    jw001 1 reverse
    jw001 1 forward

    so thats 5 times. Now, there are many different plates, with many different piece numbers all in the same table. sometimes they are mixed up abit (ie not in a nice sequence like this)

    *what i want to do, is have a macro that scans the plate ID column, and the Piece number looking for unique combinations. ie

    Plate ID Piece No Pass
    jw001 1 forward
    jw001 1 reverse
    jw001 1 forward
    jw001 1 reverse
    jw001 1 forward
    jw001 2 forward
    tz445 1 forward
    tz445 1 reverse
    jg556 4 forward

    out of all them there are just 4 unique plates/pieces

    basically how do i get the macro to just take each unique ID and piece combination, list them all in a seperate column then have it count the number of occurances for each? e.g. the result would look like this

    Plate ID Piece No Number of Passes
    jw001 1 5
    jw001 2 1
    tz445 1 2
    jg556 4 1

    i hope that makes sense. i have already kind of done this but using

    =SUMPRODUCT(--(PlateID range=a plate id),--(Piece no range=a piece no))

    i dragged it all the way down to the bottom, then went through and just deleted reocurrences because it would put 5 lots of 5 next to a plate that passed through the machine 5 times.....it took ages and i have 3 more files to do.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    Hi,

    You can do this with a pivot table if you don't want to resort to VBA

    Please see the attachment
    Attached Files Attached Files
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    06-06-2007
    Posts
    3
    i shall try that thanks!

    i looks like it'll be a little too crowded but i bet you can pare it down right?

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454
    You can either format it to get exactly what you want, or draw up another table using the pivot as your source - I'm no expert, but it beats trying to program what you wanted from VBA, and is easier than array formulas and the like.

    Enjoy,

    Dave

  5. #5
    Registered User
    Join Date
    06-06-2007
    Posts
    3
    pivot works, but its clumsy to view.... some plates have 60 pieces my monitor cant fit them all across!

+ 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