excel生成有概率的随机数?

2022-08-09 科技 104阅读
1.把这两列数据放在B2:C26单元格
2.在A2输入=IF(D$2并下拉填充至A26
3.在D2输入=RAND()
4.在E2输入=VLOOKUP(1,A2:B26,2,0)
那么E2就是需要的随机数

或者
1.把这两列数据放在B2:C26单元格
2.在D2输入=RAND()
3.在E2输入=OFFSET(B2,(D$2>SUM(C$2:C2))+(D$2>SUM(C$2:C3))+(D$2>SUM(C$2:C4))+(D$2>SUM(C$2:C5))+(D$2>SUM(C$2:C6))+(D$2>SUM(C$2:C7))+(D$2>SUM(C$2:C8))+(D$2>SUM(C$2:C9))+(D$2>SUM(C$2:C10))+(D$2>SUM(C$2:C11))+(D$2>SUM(C$2:C12))+(D$2>SUM(C$2:C13))+(D$2>SUM(C$2:C14))+(D$2>SUM(C$2:C15))+(D$2>SUM(C$2:C16))+(D$2>SUM(C$2:C17))+(D$2>SUM(C$2:C18))+(D$2>SUM(C$2:C19))+(D$2>SUM(C$2:C20))+(D$2>SUM(C$2:C21))+(D$2>SUM(C$2:C22))+(D$2>SUM(C$2:C23))+(D$2>SUM(C$2:C24))+(D$2>SUM(C$2:C25)),)
那么E2就是需要的随机数
这是相当于把方法1中A列的数集中在了一起
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com