Generate Unique Serial Number

Tbrown

New Member
Joined
Dec 17, 2019
Messages
4
Office Version
  1. 2013
Platform
  1. Windows
i want to be able to click "Generate ClientID" it generates a unique serial number that range from 1000 to 99999 and doesn't repeat
1576614042689.png
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Welcome to the Board!

Do you keep a list of them somewhere?
If so, why not just start at 1000, and take the maximum value add 1 each time?
So, if you were storing all the values in column A, it would just look like:
=MAX(A:A)+1
 
Upvote 0
I have them stored on another sheet("sheet2"). Is there a way i can pull from sheet2 using vba and it deletes the used number to avoid repeats??
 
Upvote 0
or is there a code to generate values between 1:100000000 and not repeat
 
Upvote 0
I have them stored on another sheet("sheet2"). Is there a way i can pull from sheet2 using vba and it deletes the used number to avoid repeats??
or is there a code to generate values between 1:100000000 and not repeat
I see that you are adding in conditions that weren't mentioned in your original post that change the problem immensely. You want to be sure to ask a good, complete question, so we know exactly what you are after and are not left guessing. Is there a good reason why these numbers must be random and cannot be sequential?

Your question is very much like another current question. I would recommend taking a look at this one here: Help In updating my code, Employee Number Generator
If you truly want a random number generator with no repeats, that is probably the route you are going to have to go.
If you can go with sequential numbers, you can make this much easier on yourself.
 
Upvote 0
I apologize, i'm still learning. However, the numbers can be sequential! :)
 
Upvote 0
I apologize, i'm still learning. However, the numbers can be sequential! :)
OK, great. Then my original reply should work for you. You can use the MAX function in regards to data on another sheet. Just add the sheet reference, i.e.
=MAX(Sheet2!A:A)+1
 
Upvote 0
Tbrown

You can have a look here at my thread, I am also looking for a similar thing, I have the code, just need to sort out a duplicate issue. As I have heard that some codes can end up creating a duplicate and you will need to look into this as I am

My Thread Link
 
Upvote 0
Tbrown

See my above thread, it has the code in the LAST post. You might need to tweak it for your purpose.

Column A = Employee ID number
Column B = Employee names
Column C = Shows if there is a duplicate.

How the code works
  1. When the command button is clicked, the code checks if there is data in column B, in this case the employees name.
  2. It then assigns that employee and new employee ID e.g. EmpNo. 111111
  3. Columns C shows if there is a duplicate, it will place a number in Column C anything more than 1 is a duplicate. I have been assured that it it will not produce duplicates as this was my main issue, therefore column C is only a backup

Hope this helps
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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