Forum Discussion
anbarnes3
Apr 08, 2024Copper Contributor
No duplicate cells.
Let's say I create a list of 1,000 people and use the function "randbetween" to assign each person their own special code. How can I also make sure, if I were to include new people on my list in the ...
- Apr 08, 2024
One approach is to generate more numbers than needed, remove dupes, and take the first 1000.
=LET(numbers, RANDARRAY(4000, , 1000, 9999, 1), TAKE(UNIQUE(numbers), 1000))
Randarray generates 4,000 numbers betweeen 1000-9999. The 1 is to return whole numbers with no decimals.
SergeiBaklan
Apr 08, 2024Diamond Contributor
As variant
=LET(
n, 1000,
rnd, RANDARRAY(n,,0,1),
ind, LARGE(rnd, SEQUENCE(n)),
1000 + XMATCH(ind, rnd)
)
Between 0 and 1 unique numbers are generated. When only to transform.