+ Reply to Thread
Results 1 to 5 of 5

Sequential numbering within range for multiple criteria

  1. #1
    Registered User
    Join Date
    02-22-2013
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2010
    Posts
    22

    Sequential numbering within range for multiple criteria

    Hello forks,

    I have been reading a lot but is my first time posting here so please direct me to the right pass if I am doing anything wrong here.

    I have a problem with my code that does kind of like sequential numbering, and I was hoping someone could lead me to the right direction. What I am doing is, I have a company ID on columns A, transaction ID on column E, and I have to fill column C with the transaction ID & number afterwards within each company ID for each transaction ID. Here is the example...

    ColumnA E
    1000 CCRD
    1000 CCRD
    1000 DE
    1000 DE
    1000 AR
    1000 CCRD
    1250 CCRD

    now this should look like

    1000 CCRD1
    1000 CCRD2
    1000 DE1
    1000 DE2
    1000 AR1
    1000 CCRD3
    1250 CCRD1

    I had a code with countifs and if different from one below, -1. But this won't work if there are other transaction type in between for a same company ID.

    I would really appreciate any of your help! And FYI, this is one of the code within a big macro so simple excel formula won't do it :/

    The code I had is

    Please Login or Register  to view this content.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Sequential numbering within range for multiple criteria

    Hi, jakestyeen7059,

    I like the forks .

    Maybe like this:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    02-22-2013
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Sequential numbering within range for multiple criteria

    Hello Holger,

    Yeah, I totally missed the "forks"... Let's do this again, folks

    Thank you for your response. I tried it out, and I must say I don't quite understand your code.

    Thus instead of modifying, I gotta ask you another question...

    It works but it does not refresh on every change at Column A - meaning it will keep counting up for each Column E regardless of what is in between, which is awesome, but it needs to start from 1 again for each changes in column A.

    Thank you again for your help and let me know if what I am saying doesn't make sense, because I am getting a bit confused explaining too...

    jakestyeen

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Sequential numbering within range for multiple criteria

    Hi, jakestyeen ,

    sorry but I totally missed that. Please try the altered code:
    Please Login or Register  to view this content.
    Row 1 shows headers for me, so the code starts at row 2 (you would run into trouble if you tried to compare a value from row 1 with one from the not existing row 0).

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    02-22-2013
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Sequential numbering within range for multiple criteria

    Holger,

    Thank you so much! It works perfectly! I just implemented in the macro I have and with just a few modification to fit other codes, it works great!!

    I will have to investigate how you did the countif part with the string... It's really interesting.

    I am marking this "Solved".

    Thank you again Holger)

+ 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