excel中rand函數的問題

2006-12-05 8:09 am
用rand來求6-10的隨機數? 請問公式是什麼??

回答 (3)

2006-12-05 8:21 am
✔ 最佳答案
=rand()*4 + 6

Rand() generates a random number from 0.000000000001 to 0.99999999999
(up to 12 dp)

for your usage, you have to multiply it by 4 so that it generates a random number from 0 to 4, then adds 6 to make it 6 to 10
參考: me
2006-12-08 8:34 pm
I would say this solution does not solve your problem.
The number generated is not an integer.
To ensure the result is in the range 6 to 10 (possible values = 6,7,8,9,10)
you should use this formula.

=ROUNDUP(RAND()*4) + 5
2006-12-05 8:52 am
Search from excel :)

如果您希望產生的亂數是介於 a 與 b 之間的實數,請使用公式:
RAND()*(b-a)+a

即係如果你想係6-10之間~ 咁你條公式應該係
RAND()*(10-6)+6

希望幫到你啦

2006-12-05 00:59:25 補充:
佢出黎個答案會係有點數架咁如果你想佢出整數, 當然要將個儲存格set返小數做零啦 :)


收錄日期: 2021-05-03 02:59:32
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20061205000051KK00043

檢視 Wayback Machine 備份