+ Reply to Thread
Results 1 to 18 of 18

A incremental Auto numbering based on two columns data criteria

  1. #1
    Registered User
    Join Date
    05-24-2011
    Location
    Ahmednagar, India
    MS-Off Ver
    Excel 2016
    Posts
    30

    Question A incremental Auto numbering based on two columns data criteria

    I would like to ask how to write a formula or macro as below needs:

    My column "A" contains Codes and column “B” contains a list of categories, which has different codes for each category. And for column C "Auto number Result", I would like to get a continuous number for each category from starting 1. Please see below my requirement

    • The first number for each categary should be start with "1" then increasing as per code in that category like 1,2,4,5
    • when code in category changes, the number should start over 1 in column c and go on further
    • It means as per category and its code type I want no like 1,2,34……
    • When I entered a new row with a new code with a existed category then its sequential number should be for e.g. if in category “sp5” last auto number is 4 and if new code in same category “sp5” then next incremental number would be 5
    • If same code in written for a category then auto number would be same.
    • also if I add or removed any row then the numbers wonts get changed, which already written


    I m not expert in excel but somehow i have managed to search a array (ctrl+Shift+Enter) formula and i got it but whenever I changes in data the auto number gets change, because its actually doing ranking, but i not need to rank it, i just want a unique number.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Attached my sample file and what result i expected. also given below image.

    Attachment 566503

    Need a formula or VBA code, formula will be preferable !
    Really appreciate for Help !
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by vaibhavch; 03-20-2018 at 10:09 AM. Reason: to explain better my query
    Thanks


    Vaibhav

  2. #2
    Registered User
    Join Date
    05-24-2011
    Location
    Ahmednagar, India
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: In a separate column a incremental Auto numbering based on two columns data criteria

    I hope you can help me with this problem I have. I can't seem to find a solution to this.

    Looking for help !!

  3. #3
    Registered User
    Join Date
    05-24-2011
    Location
    Ahmednagar, India
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: A incremental Auto numbering based on two columns data criteria

    Hello

    Guys Pls help me !

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,133

    Re: A incremental Auto numbering based on two columns data criteria

    Set C2=1

    in C3

    =IF(COUNTIFS($B$2:$B3,$B3)=1,1,IFERROR(INDEX($C$2:$C2,MATCH($A3&$B3,$A$2:$A2&$B$2:$B2,0)),MAX(IF($B$2:$B2=$B3,$C$2:$C2))+1))

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    Then copy down

  5. #5
    Registered User
    Join Date
    05-24-2011
    Location
    Ahmednagar, India
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: A incremental Auto numbering based on two columns data criteria

    Is it that much difficult or is it impossible ??

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,133

    Re: A incremental Auto numbering based on two columns data criteria

    Is it that much difficult or is it impossible ??
    Have you tried the formula offered?

  7. #7
    Registered User
    Join Date
    05-24-2011
    Location
    Ahmednagar, India
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: A incremental Auto numbering based on two columns data criteria

    Thanks John for replying me !

    Sorry I hv not seen your reply and before saying our reply I quoted. Yes I just saw your reply and tried in my file, its working only the thing I wanna tell you, i will illustrate to u using below images

    1)
    1.JPG

    in this image in cell A24 code is 2209 and its number is 5 and in cell A26 code is 3204 its number is 6

    2)
    2.JPG

    now i have changed the A24 code to 4565 and its number get changed to 6 but number in C 26 gets changed to 7

    3)
    3.JPG

    what I want is though I changed the value in A24 then also C26 doesnt get changed it should be same as before means 6 and new number for C24 should be next number to C26 that is 7

    Hope you understand my query

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,133

    Re: A incremental Auto numbering based on two columns data criteria

    You will need to use VBA if you want values to remain constant once they have been previously assigned.

  9. #9
    Registered User
    Join Date
    05-24-2011
    Location
    Ahmednagar, India
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: A incremental Auto numbering based on two columns data criteria

    Can you please provide me VBA code

    Thanks for helping me

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,133

    Re: A incremental Auto numbering based on two columns data criteria

    Ask Moderator to transfer to VBA/Macro forum and be sure to explain clearly what you want.

  11. #11
    Registered User
    Join Date
    05-24-2011
    Location
    Ahmednagar, India
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: A incremental Auto numbering based on two columns data criteria

    Where and how can I ask moderator to transfer it, And i explained it what i want

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,133

    Re: A incremental Auto numbering based on two columns data criteria

    I have (hopefully) contacted a moderator and requested the transfer.




    Edit by DominicB : Moved to VBA sub-forum.
    Last edited by dominicb; 03-23-2018 at 05:14 AM.

  13. #13
    Registered User
    Join Date
    05-24-2011
    Location
    Ahmednagar, India
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: A incremental Auto numbering based on two columns data criteria

    Thank you for helping

    Please provide me VBA code
    Last edited by vaibhavch; 03-23-2018 at 08:35 AM.

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,133

    Re: A incremental Auto numbering based on two columns data criteria

    You need to "define" how the code is to activated as you have an initial run which establishes the base data then subsequent runs where new data is added: it the latter where you need to explain how the macro is run.

    Are simply going to run the macro under "manual" control when new data is added i.e. you run the macro

  15. #15
    Registered User
    Join Date
    05-24-2011
    Location
    Ahmednagar, India
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: A incremental Auto numbering based on two columns data criteria

    My list will go on so I need vba code subsequent run where new data will be added regularly

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,133

    Re: A incremental Auto numbering based on two columns data criteria

    How will we know if you have changed an existing code: [or Category (?)] need to use Worksheet_Change code.

    If NEW codes added then these will be identified by column C being blank (?).

    Starting to get complicated!!!
    Last edited by JohnTopley; 03-24-2018 at 07:17 AM.

  17. #17
    Registered User
    Join Date
    05-24-2011
    Location
    Ahmednagar, India
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: A incremental Auto numbering based on two columns data criteria

    Guys , any progress

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

    Re: A incremental Auto numbering based on two columns data criteria

    Your "Change" is not clear.
    1) To Sheet1 code module
    Please Login or Register  to view this content.
    2) to a Standard code module
    Please Login or Register  to view this content.
    To initialize numbering, clear all number in column C.
    Attached Files Attached Files

+ 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. Show a Text on a Column based on the values in Two separate columns
    By Harshadewa in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-31-2017, 09:59 AM
  2. [SOLVED] Incremental count across 2 columns while considering a 3rd column
    By mikehorne23 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-29-2014, 05:13 PM
  3. How to split excel file into separate workbooks based on number of columns?
    By nandana83 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2012, 04:03 AM
  4. [SOLVED] Need to split a LONG list into separate sheets based on repeating, incremental nunbers
    By matrix_machine in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-31-2012, 04:37 PM
  5. Exporting large number of columns along with 1 fixed column into separate text files
    By akshaynr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-13-2010, 11:08 AM
  6. Adding up numbers based on number in separate column
    By jhelliar in forum Excel General
    Replies: 2
    Last Post: 09-08-2009, 04:53 PM
  7. Replies: 4
    Last Post: 10-11-2007, 01:58 PM

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