+ Reply to Thread
Results 1 to 5 of 5

Count data to a limit and increment counter

  1. #1
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    157

    Count data to a limit and increment counter

    I have a list of data and I'm trying to assign a numberical value to each line of code up to the number 30. Once I've reached 30 I'd like to increment the counter by one. For example, I have the code "APL" and it is replicated 62 times. I would like to have a counter that starts at 101 and every 30 iterations, the count will increase to 102, and finally the remaining two would be assigned to 103. Once the next unique value is reached the counter would increase to 104.

    I know this sounds a little confusing so I've attached a sample sheet. The first tab is the data as I recieve it, and the second tab shows the data as I would like to see it.

    Please note that the data will always be grouped together and in alphabetical order.
    Attached Files Attached Files
    Last edited by Ricker090; 01-14-2012 at 09:45 AM. Reason: Solved

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Count data to a limit and increment counter

    Hi Ricker090

    If i understand correctly
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Count data to a limit and increment counter

    Thinking about it, possibly should be
    Please Login or Register  to view this content.
    Last edited by pike; 01-14-2012 at 07:37 AM.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Count data to a limit and increment counter

    Hello Ricker090,

    Here is a worksheet formula solution. This uses column "C" to track when a change occurs. Column "C" holds the count of the occurrences of data in column "A" from 1 to 30. If more than 30 occurrences are found then count starts back at 1. If the data changes then count resets to 1. The formulae in column "B" then increment the value in "B1" by 1 for each 1 in column "C".

    In cell "B1" add the seed value

    In cell C1 add the number 1

    In cell B2 add this formula: =IF(C2=1,B1+1,B1)

    In cell C2 add this formula: =IF(A2<>A1,1,IF(C1=30,1,C1+1))

    Select B2 and C2 and drag the formulas down as far as needed. The attached workbook has the changes already made.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    157

    Re: Count data to a limit and increment counter

    Thanks for both of these solutions! They both work exactly as I need them.

+ 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