我正在考虑制作类似随机数字生成器的东西,显然下面的方法对于大批量生产并不是很好,但是我在这里:
A1=RANDBETWEEN(1,7+1-ROW()) -> dragged on column down to A7 generates numbers decrementally so as to use these for "the rest of the array"
C1=1;D1=2;E1=3;...;I1=7 -> these are the original numbers to be used
K1=if(a1=1,c1,if(a1=2,d1,...)) -> number at position a1 in the array
A2=RANDBETWEEN(1,7+1-ROW()) -> just drag a1 down, represents the position of the 2nd unique random number from the array
C2=IF($A1<=COLUMN()-2,D1,C1) -> the new array will skip c1 if it was picked, otherwise use C1; D2,E2,...,I1 are dragged and will perform the same operation
K2=if(a2=1,c2,if(a2=2,d2,...)) -> number at position a2 in the new array (old number from line1 was removed)
from here on out everything is dragged down, until row 7 (because there are 7 unique numbers in the array,please ignore the zeroes created b=in positions I2,H3,I3,... (because they are not assigned anything because those numbers were removed)
除了通过不使用整张纸来改善这种低效公式的事实,特别是在处理数千个单元时(内存问题)。有一种方法可以优化K1 = if(a1 = 1,c1,if( a1 = 2,d1,...))部分使用间接函数?
答案 0 :(得分:0)
似乎可以使用
=INDIRECT(ADDRESS(ROW(),COLUMN()))
。在你的情况下,用数字替换row()和column():
A1=INDIRECT(ADDRESS(ROW(),A1+2))
应该给你C1的值(当前行,a1 + 2的值,即a1 = 1 - > a1 + 2 = 3,等于列c),然后向下拖动,A2,A3 ,. ..,A7会给出正确的结果
另一种方法是使用
=INDIRECT("C"&A1)
但是因为你使用了列而不是行