简单的 Excel 函数,将输入的编号随机分割到一个单元格中,并均匀地分割到其他 3 个单元格中
我正在寻找一个简单的函数,它将接受输入到单个单元格(例如 20)中的数字,并将其均匀且随机地划分到其他三个单元格中,没有一个值可以为 0。
即。 A1=20 然后 B1=6 C1=8 D1=6
谢谢!!
I am looking for a simple function that will take a number entered into a single cell say 20 and divide it evenly and randomly over three other cells, none of the values can be 0.
ie. A1 = 20
then
B1=6
C1=8
D1=6
Thanks!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为你必须编写一个宏来自动将值扩展为 B1、C1、D1,但我的方法是将以下代码放入 B1:
将以下代码放入 C1:
将以下代码放入 D1:
如果您没有可用的 RANDBETWEEN() 函数,这里介绍如何启用它:
I think you would have to write a macro to expand the values into B1, C1, D1 automatically, but the way I would do it would be to put the following code into B1:
The following into C1:
The following into D1:
If you don't have the RANDBETWEEN() Function available here is how to enable it:
我面前没有Excel,但是像这样的东西
I don't have Excel in front of me, but something like this
如果没有宏,我看不到任何方法来绕过显示一些临时值。
看看我在这里的插图,它实现了您想要实现的目标:
http://www.gratisupload.dk/download/43627/
A2 保持初始值分割
临时值:
C2、D2、E2 只是 =RAND()
您均匀但随机分割的值将出现在这些单元格中:
C5 = A2 / (C2 + D2 + E2) * C2
D5 = A2 / (C2 + D2 + E2) * D2
E5 = A2 / (C2 + D2 + E2) * E2
编辑:当然,您可以在单独的工作表上显示临时值(C2、D2、E2)。尽管如此,只是为了避免宏的邪恶世界。
Without a macro, I dont see any way to get around having some temporary values shown.
Look at my illustration here which does what you are trying to achieve:
http://www.gratisupload.dk/download/43627/
A2 holds the initial value to split
Temporary values:
C2,D2,E2 are just =RAND()
Your evenly, but radomly split values will apear in these cells:
C5 = A2 / (C2 + D2 + E2) * C2
D5 = A2 / (C2 + D2 + E2) * D2
E5 = A2 / (C2 + D2 + E2) * E2
Edit: Of course you could show the temporary values (C2, D2, E2) on a seperate sheet. Still, only to avoid the evil world of macros.