Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Al,
not sure what anyone else's gripes are with RAND, but I find it awkward for the following: * by default RAND() will only create a random number between 0 and 1 - in order to have a different set of parameters, it's necessary to construct (e.g.) using RAND()*(b-a)+a to create a random between a and b - in which case RANDBETWEEN(a,b) is easier to use if you want an integer return (example for RAND taken from Excel Help). * every time the worksheet is refreshed, the random number wil recalculate, which means that any results based on that random number will change as well. If the cell is activated, this will also prompt a change. If any other formulae are entered anywhere else in the worksheet, this will prompt a change. This is also true of RANDBETWEEN. I've found that, for my purposes, I generally need to specify a random number between two set parameters, be they fixed values, or a value which is held in another range based on the formulae there. In these instances, RANDBETWEEN has always worked better for me, followed by a copy/pastespecial (values). However, RANDBETWEEN will only return integers, so if you require decimals, you would need to get more advanced and include mathematical functions. e.g. Range("A4").Select Selection.Formula = "=RANDBETWEEN(0,$C$36)" Selection.Copy Selection.PasteSpecial Paste:=xlValues will return a value between 0 and the value in cell ref C36, then "fix" this value so that it is held in cell A4 as a value as opposed to a continually changing formulae. Hope this helps DS "Alexander Fischer" wrote: Hello, quite some time ago, I read some comments in this group about Excel's RAND() function, saying that it was "awful". Is this true, and if so, why? Because of speed? Or because it's not "really random"? I'm not a mathematician, please use easy language on me :-) Thanks, Al |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
RAND FUNCTION | Excel Worksheet Functions | |||
HELP with the RAND() Function!!!!!! | Excel Worksheet Functions | |||
RAND FUNCTION | New Users to Excel | |||
Rand function | Excel Worksheet Functions | |||
Rand() function | Excel Discussion (Misc queries) |