Excel 函数
以下百分比为出现概率。
我如何在 Excel 中表示这些值。
35% No one buys Coffee Zing
30% 1 person buys Coffee Zing
25% 2 person buys Coffee Zing
10% 3 person buys Coffee Zing
我尝试了一下:=IF(RAND()<=1-J13-J15-J16,1,IF(RAND()<=1-J13-J14-J16,2,IF(RAND()) <=1-J13-J14-J15,3,0)))
但我不知何故感觉它不对。有什么建议吗?
The following percentage are the occurence probability.
How do I represent these values in excel.
35% No one buys Coffee Zing
30% 1 person buys Coffee Zing
25% 2 person buys Coffee Zing
10% 3 person buys Coffee Zing
I tried it out: =IF(RAND()<=1-J13-J15-J16,1,IF(RAND()<=1-J13-J14-J16,2,IF(RAND()<=1-J13-J14-J15,3,0)))
But I somehow feels its wrong. Any suggestion?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设在第 1 行中,我们有一些标头(随机 0 1 2 3),
然后在第 2 行中,我们将放置这些机会([空白] 35 30 25 10),
总结这些机会:
然后在第 3 行中,我们方便地 让我们将随机数放入 A3 中:
请注意,我将其乘以总数 (100),因为我们将其与整数进行比较,而不是与 0 到 1 表示的百分比进行比较。
第 3 行现在看起来像这样: (30.32352 35 65 90 100)
我们现在对照第 3 行中的值检查随机数,并将答案粘贴在 A4 中:
注意它不需要检查最终值,因此您可以:
Let's say in Row 1, we have some headers (Random 0 1 2 3)
Then in Row 2, we'll put those chances ([blank] 35 30 25 10)
Then in Row 3, we conveniently sum up those chances:
And let's put our random number in A3:
Notice that I'm multiplying it by the total (100), because we're comparing it to whole numbers, rather than percentages represented by 0 to 1.
Row 3 will now look something like this: (30.32352 35 65 90 100)
We now check our random number against the values in Row 3, and stick the answer in A4:
Note how it need not bother checking the final value, so you could have: