Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Randomizing Hell
Hello €“
I pick up a percentage from a given cell and based on some preset variance, say +/-10%, I need to randomly assign a new percentage to a block of cells elsewhere, based on that drivers range. So if the driver is 30% and the variance is +/-10% the range to randomly be applied to a block of cells elsewhere would be between 27%, 28%, 29%... to 33%. Each cell in that block getting a random number from that range. I have most of the looping components down; I just keep tripping over the above scenario and am not finding the pieces to put together. Any direction is greatly appreciated. Sincerely, Arturo |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Randomizing Hell
Arturo,
Te following code shows how to calculate your random numbers: Sub GenRand() Dim Driver As Double Dim Var As Double Dim Result As Double Driver = 0.3 Var = 0.1 Result = (1 - Var) * Driver + 2 * Rnd() * Var * Driver MsgBox Result End Sub (1-Var)*Driver gives you the 27% base you need. 2*Var*Driver gives you the 6% range to be added. Applying Rnd() to this gives a random number in the range. -- John Green Sydney Australia "Arturo" wrote in message ... Hello - I pick up a percentage from a given cell and based on some preset variance, say +/-10%, I need to randomly assign a new percentage to a block of cells elsewhere, based on that driver's range. So if the driver is 30% and the variance is +/-10% the range to randomly be applied to a block of cells elsewhere would be between 27%, 28%, 29%... to 33%. Each cell in that block getting a random number from that range. I have most of the looping components down; I just keep tripping over the above scenario and am not finding the pieces to put together. Any direction is greatly appreciated. Sincerely, Arturo |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Randomizing | Excel Discussion (Misc queries) | |||
Is there a simple way to do a randomizing sort? | Excel Discussion (Misc queries) | |||
checkbox hell | Excel Programming | |||
ComboBox Hell!!! | Excel Programming | |||
Excel ADO.Net Hell :S | Excel Programming |