There are many of ways to generate a random number by creating a macro written in VBA or writing your own function by using Rand() formula that may differ in many ways.
I made a VBA program in Excel 2007:
Generating a Value Between two Numbers
Int((Upperbound - Lowerbound + 1) * Rnd + Lowerbound)
e.g. for 1-10, Integer of ((10-1+1) * Rnd + 1)
That's why most programmers only use Int(10 * Rnd + 1)
Where Rnd is almost the same as Rand() is Excel
If you can't understand and you want to know the step by step procedure,
more explanation and it's logic: Click Here
Download the .xlsm file here (macro enabled document)
Here's the old office 2000-2003 format. .xls file, download here
I'm sure, it will work.
If you know more ways on How to generate numbers in random without repetition, Please Share it to us!!! Thanks in advance!![]()
-
.xlsm doens't work.
I enable macros on the file and the number box enlarges and hides the button. Hence, can't run the macro. -
you can create it using the .xls old format... just follow the procedure and it's easy. sorry it's too long and difficult to explain.
hope this helps... -
I have trouble seeing what the purpose of this might be. Why not just use the built-in rand function? More fundamentally, by eliminating "duplicates", your algorithm does generate a list of numbers that re not true random numbers. I don't want to go into the mathematics of this, but I will note that generating true random numbers on a deterministic machine is not strictly possible anyway, but that generating a good approximation to such numbers is not at all trivial...
-
Hello Pirx, Can you post some examples? No problem, I'm always open for discussion. Thanks in advance.
-
You start by going to Wikipedia for an introduction into the topic. The section on pseudo-random numbers is pertinent. -
Here's the old office 2000-2003 format. .xls file, download here
I'm sure, it will work.
Anyway, I'm always open for discussion. It will help many people.
Please post more Examples. -
I got it, just in case anyone else has the same problem, make the width of column A bigger and the button will be moved over.
-
Hello Pirx,
Came From Microsoft Excel and Visual Basic 6.0 Help Files:
Maybe you can post a sample code of your own?
Generating Random Number in Excel
Discussion in 'Windows OS and Software' started by Lawrence, Nov 17, 2008.