Problem with Index/Array and Random Number Generator

txcomposer

New Member
Joined
Jan 8, 2019
Messages
2
I am trying to build into my spreadsheet a way to have a list of values in column D. For some reason, the code in each of the G pulls random values from column D but only for cell D19 and after. It never returns any values from cells D10-D18. What am I doing wrong in my code?

ROW/COLDEFG
10A01{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
11B02{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
12C03{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
13D04{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
14E05{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
15F06{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
16G07{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
17H08{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
18I09{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
19J10{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
20K11{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
21L12{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
22M13{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
23N14{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
24O15{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
25P16{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
26Q17{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
27R18{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
28S19{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
29T20{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
30U21{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
31V22{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
32W23{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
33X24{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
34Y25{=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0)))))}
35Z

<tbody>
</tbody>
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Welcome to Mr Excel forum

See if changing
=INDEX($D$10:$D$509,...
to
=INDEX($D:$D,...
it works.

Hope this helps

M.
 
Upvote 0
Maybe add the part in red
=INDEX($D$10:$D$509,INDEX(MODE.MULT(IF($D$10:$D$509<>{"",""},ROW($D$10:$D$509))),RANDBETWEEN(0,SUM(N(LEN($D$10:$D$509)>0))))-9)
 
Upvote 0
Welcome to Mr Excel forum

See if changing
=INDEX($D$10:$D$509,...
to
=INDEX($D:$D,...
it works.

Hope this helps

M.

I think this is the correct answer. I'd love to know WHY it works, but it works. I have a macro that refreshes the random calculations as well and I just sat here clicking it for half a minute and it looks to be only pulling the data I want. I was afraid at first that doing $D:$D would pull things like the field header "INCIDENT #'s", but it doesn't for some reason. Great!

Thanks, Marcelo!
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,457
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top