Jan 10 2022 08:31 AM
Hi,
I hope someone can help me with this.
I want to create random codes using certain letters i.e. no vowels and numbers.
I would also like to create random codes of varying lengths, sometimes 7 characters sometimes 9.
Thanks in advance for any help and advice that can be given.
Jan 10 2022 09:01 AM
@Pete_Atkinson here it is a very bland calculator; since you didn't specified any other feature, I just used the first idea I had: try to check it and improve it, if necessary. It needs manual copypasting for each entry (TABLE sheet, column B, each row) to not lose the previous entry.
Hope it helps
Jan 10 2022 09:29 AM
Jan 10 2022 10:25 AM
Jan 10 2022 10:29 PM - edited Jan 10 2022 10:30 PM
Thank you for your reply.
I am using 365
The formula i posted is in it's entirety, and yes it creates a 7 character code from whatever is input in cell A1. I have attached a screen shot for clarification.
Yes the same characters can be used.
Creating codes of different lengths will depend on the application they will be used for, they will never be "mixed" so creating a file of 7 Characters and the next time might be 9 Characters. So a formula i can change would do the job or as you say having a "settable" reference cell would make life a little easier. Though i would like to understand the formula and how to alter how many characters it will create.
Jan 11 2022 02:49 PM
Solution@Pete_Atkinson so that can't be the 'whole' formula you posted as it isn't even valid. There is probably additional lines you just don't see. Regardless, here is a formula to use:
=CONCAT(MID($B$2,RANDARRAY($B$3,1,1,LEN($B$2),TRUE),1))
B2 has the list of valid characters and B3 is how long you want the code to be.
See the attached sheet.
since you specifically asked to know how it works:
the RANDARRAY creates an array of B3 number of values between 1 and the total length of the list of valid characters (B2).
the MID() looks at the list of valid characters (B2) and pulls out the character located according to the RANDARRAY
and finally CONCAT puts it all together
Jan 11 2022 11:00 PM
Jan 11 2022 02:49 PM
Solution@Pete_Atkinson so that can't be the 'whole' formula you posted as it isn't even valid. There is probably additional lines you just don't see. Regardless, here is a formula to use:
=CONCAT(MID($B$2,RANDARRAY($B$3,1,1,LEN($B$2),TRUE),1))
B2 has the list of valid characters and B3 is how long you want the code to be.
See the attached sheet.
since you specifically asked to know how it works:
the RANDARRAY creates an array of B3 number of values between 1 and the total length of the list of valid characters (B2).
the MID() looks at the list of valid characters (B2) and pulls out the character located according to the RANDARRAY
and finally CONCAT puts it all together