没心没肺的垃圾真可怕 发表于 2021-11-10 12:12:49

直接用一个公式解决不会,用10个公式可以试一下,公式从B2至B11单元格,
可直接复制以下全部公式,选中B2单元格,Ctrl + V 粘贴
=RANDBETWEEN(26,35)+TRUNC(RAND(),1)
=IF(B2<30,RANDBETWEEN(30,35),RANDBETWEEN(26,35))+TRUNC(RAND(),1)
=IF(B3<30,RANDBETWEEN(30,35),RANDBETWEEN(26,35))+TRUNC(RAND(),1)
=IF(B4<30,RANDBETWEEN(30,35),RANDBETWEEN(26,35))+TRUNC(RAND(),1)
=IF(B5<30,RANDBETWEEN(30,35),RANDBETWEEN(26,35))+TRUNC(RAND(),1)
=IF(COUNTIF(B$2:B6,"<30")=3,RANDBETWEEN(30,35),IF(COUNTIF(B$2:B6,"<30")=0,RANDBETWEEN(26,29),IF(B6<30,RANDBETWEEN(30,35),RANDBETWEEN(26,35))))+TRUNC(RAND(),1)
=IF(COUNTIF(B$2:B7,"<30")=3,RANDBETWEEN(30,35),IF(B7<30,RANDBETWEEN(30,35),RANDBETWEEN(26,35)))+TRUNC(RAND(),1)
=IF(COUNTIF(B$2:B8,"<30")=3,RANDBETWEEN(30,35),IF(COUNTIF(B$2:B8,"<30")=1,RANDBETWEEN(26,29),IF(B8<30,RANDBETWEEN(30,35),RANDBETWEEN(26,35))))+TRUNC(RAND(),1)
=IF(COUNTIF(B$2:B9,"<30")=3,RANDBETWEEN(30,35),IF(B9<30,RANDBETWEEN(30,35),RANDBETWEEN(26,35)))+TRUNC(RAND(),1)
=IF(COUNTIF(B$2:B10,"<30")=3,RANDBETWEEN(30,35),RANDBETWEEN(26,29))+TRUNC(RAND(),1)

风随我 发表于 2021-11-18 02:13:47

太强了!纯公式,谢谢大神!

帅到宇宙没朋友 发表于 2021-11-21 21:23:42

大神,可以请教下几点吗?
如果26~29换其他、30~35换其他、3个26~29换成1个或2个,要怎么改?

烤肉店小哥哥 发表于 2021-11-22 07:26:00

大神,可以请教下几点吗?
如果26~29换其他、30~35换其他、3个26~29换成1个或2个,要怎么改?

用户喜子 发表于 2021-11-25 16:05:07

公式中的 RANDBETWEEN(26,35)、RANDBETWEEN(26,29)、RANDBETWEEN(30,35)就是用来生成不同范围的随机数的,可以根据需要将 "<=30"改为相应的判断
最麻烦的是控制特殊值的数量,3个换成2个或者其他数,很多公式都要根据实际情况改。
你这个问题我想不到简单的办法

不能 发表于 2021-11-30 09:44:50

好的,已经可以了,谢谢大佬

有准备有未来 发表于 2021-12-2 14:15:19

大神,这公式小概率出现第5、第6个随机数为26~29,也就是相邻的情况

月红 发表于 2021-12-7 22:50:32

=MOD(SMALL(IF({0;1},RANDBETWEEN({9,9,9,9,9},99)*{-1,1,0,0,0}+{0,0,1,2,3},RANDBETWEEN(-11*{9,9,9,9,9},99))/1%%+RANDBETWEEN({3,3,3,3,3;2.6,2.6,3,2.6,3}/1%,{35,35,35,35,35;26,26,35,26,35}*10+9),{0;5}+COLUMN(A:E)),1000)/10

保险点再加个限制
=MOD(SMALL(IF({0;1},RANDBETWEEN({9,9,9,9,9},99)*{-1,1,0,0,0}+{0,0,1,2,3},-1^RANDBETWEEN({9,9,9,9,9},99)*RANDBETWEEN({9,9,9,9,9},99))/1%%+RANDBETWEEN({3,3,3,3,3;2.6,2.6,3,2.6,3}/1%,{35,35,35,35,35;26,26,35,26,35}*10+9),{0;5}+COLUMN(A:E)),1000)/10

牵你手 发表于 2021-12-9 10:39:25

太强了!纯公式,谢谢大神!

那什么和勒布朗比 发表于 2021-12-14 06:00:28

大神,可以请教下几点吗?
如果26~29换其他、30~35换其他、3个26~29换成1个或2个,要怎么改?
页: 1 2 [3] 4
查看完整版本: 求助大佬:随机生成数字且随机排列