how to we produce unique radom transaction ID's like this 6746F427-76D0-98AD-5990-4BD12A7F3916?
how to we produce unique radom transaction ID's like this 6746F427-76D0-98AD-5990-4BD12A7F3916?
.
Paste into a regular module.
Please Login or Register to view this content.
you posted in vba, so i'll give a vba solution. though this can be done using formulas as well. hard to tell for 1 ID, but the pattern i see is 4 digits, single alphabet or a permanent "F", 3 digits, dash, 2 digits, 1 alphabet or a permanent "D", 1 digit or zero, etc
to randomize numbers, there's a function RANDBETWEEN. since it's 4 digits, randomize between 1 and 9999. you don't want just 1 to appear but 0001. so use FORMAT (TEXT in Excel) to show 4 digits.
to randomize alphabets, there's a certain character code for each of them. you can find out through Excel via:
=CODE("A")
to combine them, use ampersand (&)
you'll see 65 shown. Z would be 90. CHR (CHAR in Excel) to choose the code. so CHR(RANDBETWEEN(65 and 90)).
something along this for the first part:
=TEXT(RANDBETWEEN(1,9999),"0000")&"-"&CHAR(RANDBETWEEN(65,90))&TEXT(RANDBETWEEN(1,999),"000")Please Login or Register to view this content.
you can continue with the rest
Thanks, if you have clicked on the * and added our rep.
If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".
"Contentment is not the fulfillment of what you want, but the realization of what you already have."
Tips & Tutorials I Compiled | How to Get Quick & Good Answers
Thanks Logit and benishiryo for your efforts.
I did end up finding this formula to work instead:
=CONCATENATE(DEC2HEX(RANDBETWEEN(0,4294967295),8)," ",DEC2HEX(RANDBETWEEN(0,42949),4),"-",DEC2HEX(RANDBETWEEN(0,42949),4),"-",DEC2HEX(RANDBETWEEN(0,42949),4),"-",DEC2HEX(RANDBETWEEN(0,4294967295),8),DEC2HEX(RANDBETWEEN(0,42949),4))
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks