Increment alphanumeric column value by 1

Teckel_luv

New Member
Joined
May 23, 2012
Messages
4
Hello,

I'm using Excel 2007 on a Windows XP box for creating QA test cases. I looked through the forum and haven't found an answer to my question.

I need to be able to auto increment my test case ID in column A by 1 when I hit 'Enter' or click on the next row.
I.E. The test case ID value in A4 = 'VM_TEST_001' and I want it to increment to 'VM_TEST_002' in A5 and 'VM_TEST_003' in A6, etc. w/o having to drag the Autofill cross down several hundred rows every time I need to add a new row for another test case.

Any help would be appreciated!
Thanks in advance!
:confused:
 
Thanks for that - here is the example of what I would like it to be - scroll down to bottom to see how the numbering changes depending on the type in column B - and then resumes the numbering order by type each time the type is changed.
A1315-PCN-001</SPAN>PCN</SPAN>
A1315-PCN-002</SPAN>PCN</SPAN>
A1315-PCN-003</SPAN>PCN</SPAN>
A1315-PCN-004</SPAN>PCN</SPAN>
A1315-PCN-005</SPAN>PCN</SPAN>
A1315-PCN-006</SPAN>PCN</SPAN>
A1315-PCN-007</SPAN>PCN</SPAN>
A1315-PCN-008</SPAN>PCN</SPAN>
A1315-PCN-009</SPAN>PCN</SPAN>
A1315-PCN-010</SPAN>PCN</SPAN>
A1315-PCN-011</SPAN>PCN</SPAN>
A1315-PCN-012</SPAN>PCN</SPAN>
A1315-PCN-013</SPAN>PCN</SPAN>
A1315-PCN-014</SPAN>PCN</SPAN>
A1315-PCN-015</SPAN>PCN</SPAN>
A1315-BCN-001</SPAN>BCN</SPAN>
A1315-CCN-001</SPAN>CCN</SPAN>
A1315-PCN-016</SPAN>PCN</SPAN>
A1315-PCN-017</SPAN>PCN</SPAN>
A1315-BCN-002</SPAN>BCN</SPAN>
A1315-BCN-003</SPAN>BCN</SPAN>
A1315-CCN-002CCN</SPAN>
A1315-PCN-018</SPAN>PCN</SPAN>
A1315-PCN-019</SPAN>PCN</SPAN>

<TBODY>
</TBODY><COLGROUP><COL><COL></COLGROUP>
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Use Column A as a helper column and enter this formula in A4 and copy down:
=IF(B4="","",$B$2&"-"&B4)

Then in Column C, enter this formula in C4 and copy down:
=IF(B4="","",A4&"-"&TEXT(COUNTIF(A$4:A4,A4),"000"))

If you need the final numbered results in Col A, then put the 1st formula in any column available, and then put the 2nd formula in Col A but adjust the Col A references in the formula to whatever column you placed the 1st formula.
 
Upvote 0
Perfect - you're a legend - thank you so much - this will be a useful formula for future unique incremental auto-numbering key id creation without use of script.
 
Upvote 0
The auto-numbering above works perfect - however I am converting some data over from another system and have to retain the original historic numbers issued which is fine but from the last record in the old system I want to re-start the auto-numbering from that last number so how do I change the formula to do this - below is an example of the data and the column on the far right is the orginal number - so the second instance of EHLH-2337 (in column 3) should be EHLH-2338, then 2339 - the last entry in the 3rd column should be EHLH-2340 - hope I have explained well enough and given good enough example - thanks so much in advance

Hose</SPAN>EHLH</SPAN>EHLH-2335</SPAN>EHL2335</SPAN>
Hose</SPAN>EHLH</SPAN>EHLH-2336</SPAN>EHL2336</SPAN>
Hose</SPAN>EHLH</SPAN>EHLH-2337</SPAN>EHL2337</SPAN>
Hose</SPAN>EHLH</SPAN>EHLH-2337</SPAN>
Hose</SPAN>EHLH</SPAN>EHLH-2337</SPAN>
Calibration</SPAN>EHLC</SPAN>EHLC-0001</SPAN>
Gauge</SPAN>EHLG</SPAN>EHLG-0001</SPAN>
Hose</SPAN>EHLH</SPAN>EHLH-0619</SPAN>

<TBODY>
</TBODY><COLGROUP><COL><COL><COL><COL></COLGROUP>
 
Upvote 0
Thanks for that - here is the example of what I would like it to be - scroll down to bottom to see how the numbering changes depending on the type in column B - and then resumes the numbering order by type each time the type is changed.
A1315-PCN-001
PCN
A1315-PCN-002
PCN
A1315-PCN-003
PCN
A1315-PCN-004
PCN
A1315-PCN-005
PCN
A1315-PCN-006
PCN
A1315-PCN-007
PCN
A1315-PCN-008
PCN
A1315-PCN-009
PCN
A1315-PCN-010
PCN
A1315-PCN-011
PCN
A1315-PCN-012
PCN
A1315-PCN-013
PCN
A1315-PCN-014
PCN
A1315-PCN-015
PCN
A1315-BCN-001
BCN
A1315-CCN-001
CCN
A1315-PCN-016
PCN
A1315-PCN-017
PCN
A1315-BCN-002
BCN
A1315-BCN-003
BCN
A1315-CCN-002
CCN
A1315-PCN-018
PCN
A1315-PCN-019
PCN

<tbody>
</tbody>

To get the above;
Assuming that A1315 is constant (or whatever alpha-numeric code begins the sequence.
Give this formula a try. It doesn't need a helper column.

=IF(B4="","","A1315-"&B4&"-"&TEXT(COUNTIF(B$4:B4,B4),"000"))
 
Upvote 0
In your new example, the new prefix is 4 characters but the old prefix is 3 characters. Further, the 1st 3 characters of the new prefix are used in more than one 4 character prefix. So if an old part number begins EHL, how do you know that it is associated with only EHLH and not with EHLC or EHLG? Also, in your sample data, I presume that EHLH must have occurred 618 times earlier in the data in order for the last entry to come out to EHLH-0619. Please let me know if I'm misinterpreting this.
 
Upvote 0
This is a completely different set of data all together but am using the same formula to create an auto-numbering system code so in this case the prefix may be even 5 characters in some instances but don't believe it impacts on the forumla - and yes EHL will always be the first 3 characters and yes you are correct EHLH has occurred 618 times earlier in the data. EHLH2337 is the last number in the "old" system so I need the new numbering system to start incrementing automatically from that number. I tried different variations to the formula but came unstuck and decided you guys are the experts and extremely efficient and quick at responding. Thanks
 
Upvote 0
The problem is I don't see a way to associate the old part number EHL2337 with a specific new prefix - eg: the new prefix's are EHLH (which you want it associated to) but also ELHC and ELHG which you don't want it associated to. In your sample data the "description" is hose, but my experience is description fields are never consistent (eg: might be "hose" for most hoses but some might be "hose-3/4 inch" or other variations in spelling). Is there some other field available that could be the key to linking?
 
Upvote 0
For the field with hose in, a validation list is used so there are only 5 or 6 different types and I used the "helper" part of your original formula to build the prefix part of the second formula based on that column - so in my mind that part works perfectly, it is the auto-numbering allocation part of the formula where I want it to start numbering from 2338 so I would expect the change I need to make needs to be in that part of the countif formula. I forgot to mention the numbering up to 2337 is not a formula as they are hard copied into the spreadsheet as we cannot change them for historical audit purposes - hence why with the above example it reverts to EHLH-619 after the EHLH2337 (and correctly so for the formula and number of hose items captured). But I actually want the formula to start auto-numbering from that point forward - I just don't know how to write the countif bit to make it start from 2338 (for the hoses only) and continue on, so it may require two countif statements to accomodate everything else starting at 0001. I hope I haven't muddied the waters too much and have clarified for you? Cheers
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,772
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top