生成总和为常数K - Excel的N个随机数 [英] Generate N random numbers whose sum is a constant K - Excel
问题描述
如何在Excel中生成这些数字。
我必须生成总和为320的8个随机数,我需要大约100个左右。
http://en.wikipedia.org/wiki/User:Skinnerd/Simplex_Point_Picking 。这里有两种方法。
或任何其他方式,所以我可以在Excel中执行。
您可以使用 RAND()
函数生成 N
数字(您的然后,在列B中,您可以使用以下公式: B1 = A1 / SUM(A:A)* 320
, B2 = A2 / SUM(A:A)* 320
等等(其中 320
是您感兴趣的金额)。
所以你可以输入 = RAND()
A1,然后将其拖到A8。然后在B1中输入 = A1 / SUM(A:A)* 320
并将其拖动到B8。 B1:B8现在包含8个随机数,总和高达320.
样本输出:
How can I generate those numbers in Excel.
I have to generate 8 random numbers whose sum is always 320. I need around 100 sets or so. http://en.wikipedia.org/wiki/User:Skinnerd/Simplex_Point_Picking. Two methods are explained here.
Or any other way so I can do it in Excel.
You could use the RAND()
function to generate N
numbers (8 in your case) in column A.
Then, in column B you could use the following formula B1=A1/SUM(A:A)*320
, B2=A2/SUM(A:A)*320
and so on (where 320
is the sum that you are interested into).
So you can just enter =RAND()
in A1, then drag it down to A8. Then enter =A1/SUM(A:A)*320
in B1 and drag it to B8. B1:B8 now contains 8 random numbers that sum up to 320.
Sample output:
这篇关于生成总和为常数K - Excel的N个随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!