我尝试编写一个基于数据库的简单随机数发生器,用于随机组合数据。由于没有aggregat
我已经尝试过LARGE
和MAX
,但是它没有随机化,并且使用SUBTOTAL不能正常工作。我以为它也可以基于ROW
,但也许我有一个错误的概念。
excel中的代码是这样的(我使用的是德语版本的Excel,但这应该是英语的等效版本)
=TEXTJOIN(" ";TRUE;INDIRECT("A"&ROUNDUP(RAND()*AGGREGAT(14;4;(A:A<>"")*ROW(A:A);1);0));INDIRECT("B"&ROUNDUP(RAND()*AGGREGAT(14;4;(B:B<>"")*ROW(B:B);1);0));INDIRECT("C"&ROUNDUP(RAND()*AGGREGAT(14;4;(C:C<>"")*ROW(C:C);1);0)))
正如我所提到的,没有aggregat
,而且我查找的其他解决方案对我来说都不起作用。
答案 0 :(得分:0)
在Google表格中,有多个可以模仿AGGREGATE
的公式,例如QUERY
,FILTER
,VLOOKUP
,HLOOKUP
,LOOKUP
,INDEX
/ MATCH
,并且取决于所提到的最适合的任务。
=INDEX(INDIRECT("A1:A"&COUNTA(A1:A)); RANDBETWEEN(1; COUNTA(A1:A)))
=INDEX({INDIRECT("A1:A"&COUNTA(A1:A))\
INDIRECT("B1:B"&COUNTA(B1:B))\
INDIRECT("C1:C"&COUNTA(C1:C))}; RANDBETWEEN(1; COUNTA(A1:A)))
={INDEX(INDIRECT("A1:A"&COUNTA(A1:A)); RANDBETWEEN(1; COUNTA(A1:A)))\
INDEX(INDIRECT("B1:B"&COUNTA(B1:B)); RANDBETWEEN(1; COUNTA(B1:B)))\
INDEX(INDIRECT("C1:C"&COUNTA(C1:C)); RANDBETWEEN(1; COUNTA(C1:C)))}
=INDEX({INDIRECT("A1:A"&COUNTA(A1:A));
INDIRECT("B1:B"&COUNTA(B1:B));
INDIRECT("C1:C"&COUNTA(C1:C))}; RANDBETWEEN(1; COUNTA(A1:C)))
=JOIN(" "; {PROPER(
INDEX(INDIRECT("A1:A"&COUNTA(A1:A)); RANDBETWEEN(1; COUNTA(A1:A))))\
INDEX(INDIRECT("B1:B"&COUNTA(B1:B)); RANDBETWEEN(1; COUNTA(B1:B)))\
INDEX(INDIRECT("C1:C"&COUNTA(C1:C)); RANDBETWEEN(1; COUNTA(C1:C)))})&"."