+ Reply to Thread
Results 1 to 4 of 4

Restart and increment numbers in column based on changed value in adjacent column

  1. #1
    Registered User
    Join Date
    09-19-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Restart and increment numbers in column based on changed value in adjacent column

    Hi,

    I have created a macro that is manipulating some data and have hit a road block. At each change in the value in column A I am trying to figure out how to reset the value in column B to 1 and begin incrementing the value again.

    A B
    111 1
    111 2
    111 3
    222 1
    222 2
    222 3
    222 4
    333 1

    Attached is a sample of the end data I am looking for.

    Thanks.Sample Result.xlsx

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Restart and increment numbers in column based on changed value in adjacent column

    B1:

    =COUNTIF(A$1:A1,A1)

    and filldown

  3. #3
    Registered User
    Join Date
    09-19-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Restart and increment numbers in column based on changed value in adjacent column

    Thank you. However, that is not exactly what I was looking for.

    I was looking to start a count in B1 at 1 and increment it by a value of 1 for every row in which A1 is 1111. When the values in column A changes to 2222 I want the counter to re-set to a value of 1 and again increment by a value of 1 until the value in column A changes again. I was also looking for vba code rather than a formula.

  4. #4
    Registered User
    Join Date
    09-19-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Restart and increment numbers in column based on changed value in adjacent column

    jindon,

    After spending a little more time this problem you response did get me pointed in the right direction. Here's what I resolved:
    Please Login or Register  to view this content.
    Thank you!

+ 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