一组选项中的 Excel 随机数 [英] Excel Random number from a set of options
本文介绍了一组选项中的 Excel 随机数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 MS Excel 中,如何随机计算来自一组 5 个选项之一的数字?
In MS Excel, how can I randomly calculate a number number that is from one of a set of 5 options?
例如,在单元格 B1 中,我想要一个随机数,它可以是 15、30、50、75 或 100.
For example, in cell B1 I would like to have a random number that is either 15,30,50,75, or 100.
我想在单元格 B1:B100 中完全随机输出这 5 个数字.
I would like a completely random output of these 5 numbers in cells B1:B100.
我想我可以使用rand在单元格A1中生成一个随机数,然后使用一系列>或<IF 语句仅输出上述数字之一.
I was thinking that I could generate a random number in cell A1 using rand, then using a series of > or < IF statements to output only one of these numbers above.
推荐答案
这个公式可以做到:
=CHOOSE(RANDBETWEEN(1,5),15,30,50,75,100)
如果您想使用一系列单元格:
If you want to use a range of cells:
=INDEX($B$2:$B$6,RANDBETWEEN(1,5))
这篇关于一组选项中的 Excel 随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文