excelNewbie22
Well-known Member
- Joined
- Aug 4, 2021
- Messages
- 531
- Office Version
- 365
- Platform
- Windows
hi!
i have a dynamic range of number, every few days changes,
a2:a1000, or a2:a1515....
and i want to get random x numbers which will cover most of the range,
by getting the entire count of the range, say... 950, divides to say... 15, which will be 63 (round),
so i'll get 1 random number from each 62 cells,
so i did this:
but this is long, is there anything more clever? shorter? (the end result will be a much longer)
i have a dynamic range of number, every few days changes,
a2:a1000, or a2:a1515....
and i want to get random x numbers which will cover most of the range,
by getting the entire count of the range, say... 950, divides to say... 15, which will be 63 (round),
so i'll get 1 random number from each 62 cells,
so i did this:
sheet1 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | |||
1 | 950 | divide to 15 | vstack | |||||||
2 | 1 | 63 | so… | 1 | 63 | 2 | 24 | |||
3 | 2 | 64 | 126 | 0 | 0 | |||||
4 | 3 | 127 | 189 | |||||||
5 | 4 | 190 | 252 | |||||||
6 | 5 | |||||||||
7 | 6 | |||||||||
8 | 7 | |||||||||
9 | 8 | |||||||||
10 | 9 | |||||||||
11 | 10 | |||||||||
12 | 11 | |||||||||
13 | 12 | |||||||||
14 | 13 | |||||||||
15 | 14 | |||||||||
16 | 15 | |||||||||
17 | 16 | |||||||||
18 | 17 | |||||||||
19 | 18 | |||||||||
20 | 19 | |||||||||
21 | 20 | |||||||||
22 | 21 | |||||||||
23 | 22 | |||||||||
24 | 23 | |||||||||
25 | 24 | |||||||||
26 | 25 | |||||||||
27 | 26 | |||||||||
28 | 27 | |||||||||
29 | 28 | |||||||||
30 | 29 | |||||||||
31 | 30 | |||||||||
32 | 31 | |||||||||
33 | 32 | |||||||||
sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
B2 | B2 | =ROUND(950/15,0) |
H2:H3 | H2 | =VSTACK(TRANSPOSE(LET(u,UNIQUE(TOROW(A2:INDIRECT("a"&$B$2+2)),1),TAKE(SORTBY(u,RANDARRAY(,COLUMNS(u))),,1))),TRANSPOSE(LET(u,UNIQUE(TOROW(INDIRECT("a"&$B$2+3):INDIRECT("a"&$B$2*2+(2))),1),TAKE(SORTBY(u,RANDARRAY(,COLUMNS(u))),,1)))) |
G2 | G2 | =TRANSPOSE(LET(u,UNIQUE(TOROW(A2:INDIRECT("a"&$B$2+2)),1),TAKE(SORTBY(u,RANDARRAY(,COLUMNS(u))),,1))) |
G3 | G3 | =TRANSPOSE(LET(u,UNIQUE(TOROW(INDIRECT("a"&$B$2+3):INDIRECT("a"&$B$2*2+(2))),1),TAKE(SORTBY(u,RANDARRAY(,COLUMNS(u))),,1))) |
Dynamic array formulas. |
but this is long, is there anything more clever? shorter? (the end result will be a much longer)