Assign next sequential number in a non-sequential list

fangfacekitty

Board Regular
Joined
Jul 28, 2010
Messages
63
I am creating a list of all assigned document numbers for the company. The document numbers are assigned sequentially based on the components of the numbering system (Region-Dept-Document Type-XX). I want to automatically assign the document number to all new documents added to the list to prevent the duplication that will happen if I leave it to people to assign the number manually.

It's easy to concatenate the first 3 sections of the document number; where I am stumped is how to generate the next specific sequential number for the new document.
Example: Rows 2:7 already exist. My users want new forms in Europe and North America for the IT department, which should auto assign the document numbers EU-IT-F-02 (cell D8) and NA-IT-F-01 (cell D9) because this is the 2nd form created for Europe IT but the 1st form created for North America IT.


I've thought about using COUNTIF and adding 1 to the result to get the next sequential number but currently I have 200 unique combinations of the first 3 segments (region-dept-doc type), so this really doesn't seem workable.

Any ideas are greatly appreciated!
 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Here is the table, not sure if the image is visible:
Column1ABCDE
1RegionDeptDoc TypeNumberTitle
2ASHRPAS-HR-P-01JKL
3CORPHRPCORP-HR-P-01ABC
4CORPHRPCORP-HR-P-02PQR
5EUITFEU-IT-F-01MNO
6NAFININA-FIN-I-01DEF
7NAITPNA-IT-P-01GHI
8EUITFEU-IT-F-XXSTU
9NAITFNA-IT-F-YYXYZ
 
Last edited by a moderator:
Upvote 0
Hi,

This is one way, once the number reaches 99, it'll go to 100 and continue.

00 HTML Conversions.xlsm
ABCDE
1RegionDeptDoc TypeNumberTitle
2ASHRPAS-HR-P-01JKL
3CORPHRPCORP-HR-P-01ABC
4CORPHRPCORP-HR-P-02PQR
5EUITFEU-IT-F-01MNO
6NAFININA-FIN-I-01DEF
7NAITPNA-IT-P-01GHI
8EUITFEU-IT-F-02STU
9NAITFNA-IT-F-01XYZ
Sheet595
Cell Formulas
RangeFormula
D2:D9D2=A2&"-"&B2&"-"&C2&"-"&TEXT(COUNTIF(D$1:D1,A2&"-"&B2&"-"&C2&"-"&"*")+1,"00")


Formula copied down.
 
Last edited by a moderator:
Upvote 0
Solution
You're welcome, thanks for the feedback.
 
Upvote 0
Hi jtakw, i have asimilar requirement. However, I could find the formula you mentioned that copied below. Can you please repost it?
 
Upvote 0
Welcome to the MrExcel board!

When the forum was upgraded recently, some posts have not rendered correctly under the new software. I have fixed the post above so you should be able to get that formula now.
 
Upvote 0

Forum statistics

Threads
1,214,396
Messages
6,119,268
Members
448,881
Latest member
Faxgirl

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