5-digit Random Unique Alphanumeric Code

mcodden

New Member
Joined
Jul 15, 2015
Messages
1
I am looking to create a 5-digit random alphanumeric code that is unique because they will be associated as certain discount/promo codes. We need them to follow the format of: letter, number, letter, number, letter. Example: f9d8s, a8b2w, y6x3q, g0o5n,w2p3p, n1g8v.

I know I can create random codes using RANDBETWEEN if needed, but I know this will eventually create duplicate codes and we need to make sure all of the codes are unique. There are 1.7million combinations, so we should be able to use this generator for a long time if I can figure out how the formula/macro.

Thanks!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
I see your problem. Firstly, this will generate the proper codes:

=CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(65,90))

[source: http://www.clickconsulting.com/forum/excel-support/random-alphanumeric-values-excel]

Secondly, you can keep a log of the codes you publish and then check to see if a new candidate has been created.


Excel 2012
AB
1K1S1DFALSE
2
3Published
4E5Q9W
5T7P0M
6G7S5X
7D2Z5I
8X1N5G
9Z8D3K
10L0H7P
11P6H2I
12K8F1Z
13G9S8T
Sheet69
Cell Formulas
RangeFormula
A1=CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(65,90))&RANDBETWEEN(0,9)&CHAR(RANDBETWEEN(65,90))
B1=IF(SUMPRODUCT(--(A1=A:A))>1,"Duplicate")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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