Attempting to create formula to generate sequential customer ID numbers

Diaxus

Board Regular
Joined
Mar 14, 2017
Messages
55
I need to generate sequential numbers to serve as individual customer ID numbers, and these numbers must first reference a three digit number derived from the customer's zip code.

Example; there are two 3 digit codes, 503 and 504. These are derived from zip codes. I need the formula to determine which of these two I input into one cell, and from that generate a 5 digit number, which base is 00001. If done right, assuming I input 503, the first time I do so the final cell will show 503-00001. When I use 503 again in a different cell, the code will read 503-00002, and so on until it reaches 503-99999.

I need the formula to generate this range from 00001 to 99999 based solely on the 3 digit number I choose, so that the first time I use 503, I will get 503-00001, and the first time I use 504, I will get 504-00001.

I hope this makes sense.

Currently, I have created a drop down list in B column to choose the 3 digit code, and have special formatted column C to show -00000. Thus, the code can hopefully reference column B and input the formulaic result into column C.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I think I might have a solution, if there is a formula that looks for the last instance in a column range of a specific value, say 503. So far, all options I've found report the first instance, such as INDEX/MATCH.
 
Upvote 0
Assuming row 1 is headers, your formula for C2 is
=IF(B2="","",COUNTIF(B$2:B2,B2))
 
Upvote 0
I'm going to laugh if it's that easy, not at you by any means. I spent 4 hours on this and created one of the most elaborate circular arguments I've ever made... LOL

I was going to attach my sample workbook so you could have some laughs too, but I'm not seeing an attachment option... perhaps I'm just that tired.

Anyway, I'll plug your solution in tomorrow and get back to you. Thanks for your help.
 
Upvote 0
Hope it works! The idea is that by fixing one end of the COUNTIF range, it will count the number of times that prefix appears up to and including the current row. It won't stop when it gets to 99,999, but I'm guessing you picked that number of digits because its higher than you think that you'll need.

You're right that you can't attach files directly in this site, however if you do have questions in future where it would be useful to show the file, you can upload it to somewhere like Google Drive or Dropbox, and paste the URL into your question. The forum recognises it as a URL and generates a link. Only thing to bear in mind is that some people will be wary about downloading from links.
 
Upvote 0
I am so sorry I haven't gotten back to you! I got pulled of that part of the project to get other parts in order, but I will return to this when all other parts are done. I will get back to you if/when I am able to attempt the fix. Thanks again for your time and effort!
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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