Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Randomizing James Silverton[_3_] Excel Discussion (Misc queries) 3 March 20th 10 03:32 PM
Is there a simple way to do a randomizing sort? BrentG Excel Discussion (Misc queries) 1 September 20th 05 04:32 PM
checkbox hell eRiC Excel Programming 3 July 16th 04 07:09 PM
ComboBox Hell!!! Dave Baranas Excel Programming 4 August 15th 03 06:42 PM
Excel ADO.Net Hell :S Kevin Harrison Excel Programming 4 August 14th 03 11:09 AM


All times are GMT +1. The time now is 04:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"