答案1
要使用公式执行此操作,它将采用 Office 365 订阅中提供的动态数组公式:
=CHOOSE(INDEX(UNIQUE(RANDARRAY(100000,,1,25,TRUE)),SEQUENCE(5,,0)*5+SEQUENCE(1,5)),"B","B","B","B","B","B","B","B","R","R","R","R","R","R","R","R",CHOOSE(RANDBETWEEN(1,2),"B","R"),"Bl","W","W","W","W","W","W","W")
UNIQUE(RANDARRAY(100000,,1,25,TRUE))
以随机模式构建 1 到 25 之间的数字数组。
INDEX(...,SEQUENCE(5,,0)*5+SEQUENCE(1,5))
将它们构建成一个 5 x 5 的数组。
然后,CHOOSE 会将正确的颜色作为单词放置在正确的单元格中,并CHOOSE(RANDBETWEEN(1,2),"Blue","Red")
随机选择“额外”是黑色还是红色。
要使用正常公式,需要一个辅助列
=AGGREGATE(14,7,ROW($1:$25)/(COUNTIFS($Z$1:Z1,ROW($1:$25))=0),RANDBETWEEN(1,25-COUNT($Z$1:Z1)))
并向下复制25行。
然后将其放入 A1 中并复制 5 和 5:
=CHOOSE(INDEX($Z$2:$Z$26,(ROW(A1)-1)*5+COLUMN(A1)),"B","B","B","B","B","B","B","B","R","R","R","R","R","R","R","R",CHOOSE(RANDBETWEEN(1,2),"B","R"),"Bl","W","W","W","W","W","W","W")
然后只需创建条件格式规则即可将单词转换为颜色。
然后按 F9 进行另一个随机设计,以创建 1 到 25 之间的随机数。在 Z1 中输入,Helper
然后在 Z2 中输入: