I have to create a unique 4-digit numerical ID's through scripts or formulas only in Google Sheets. I am not allowed to copy and paste the values.
Asked
Active
Viewed 647 times
0

player0
- 124,011
- 12
- 67
- 124
-
https://support.google.com/docs/forum/AAAABuH1jm0_i5SJ6Bce2Q/?hl=en&gpf=%23!topic%2Fdocs%2F_i5SJ6Bce2Q and https://stackoverflow.com/questions/20587371/script-to-generate-random-numbers-in-multiple-cells should come in handy. – StardustGogeta Jul 24 '19 at 13:54
-
What purpose do the IDs serve? Why do you need to generate IDs that are _both_ random _and_ unique? Can you just use the row and column number instead, which are already unique? – Peter O. Jul 25 '19 at 01:11
1 Answers
1
let's say to generate 14x random 4-digit non-repeatable number:
=ARRAY_CONSTRAIN(ARRAYFORMULA(UNIQUE(
RANDBETWEEN(0, 9*(ROW(1:1000)^0))&
RANDBETWEEN(0, 9*(ROW(1:1000)^0))&
RANDBETWEEN(0, 9*(ROW(1:1000)^0))&
RANDBETWEEN(0, 9*(ROW(1:1000)^0)))), 14, 1)

player0
- 124,011
- 12
- 67
- 124