Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Getting RAND() value but NOT its Function?!?

Hi everyone,

Say I am using a linear term such as " b * X "; where "b" is a
parameter while "X" is a variable...

Now, assume that "b" is RAND() value and assume I am using an excel
optimizer. When I run the optimizer, it complains that the problem
doesn't satisfy linearity conditions; because RAND() is a function so
it turns "b * X" to become non-linear!!!

I tried to go around this by creating another cell which copy and
value-paste the RAND() value into it. It solves the problem, but now I
have different problem: when RAND() value is copied and value-pased
and, by the time it is put in the new cell, the original cell which has
RAND() function changes its value.....and so on!!

How can I go around this correctly, so I keep the model linear and keep
RAND() values in both cells same?

Thanks,
Mike

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Getting RAND() value but NOT its Function?!?

The RAND() function is problematic this way since it recalculates with the
other cells, and you need the other cells to recalculate so you cannot keep
the random cell from a recalc. You could turn calculation to manual, put
your RAND() function in a cell on a different sheet, and then use the "Calc
Sheeet" (in Options... Calculation) but that is a cumbersome workaround.

Instead, don't use the Rand Function but use this VBA code attached to a
Command Button:
Public Sub RandomValue()
Randomize
Range("A1") = Rnd()
End Sub

This will feed a new random value into A1 when - and only when - you press
the button.
--
- K Dales


"Mike" wrote:

Hi everyone,

Say I am using a linear term such as " b * X "; where "b" is a
parameter while "X" is a variable...

Now, assume that "b" is RAND() value and assume I am using an excel
optimizer. When I run the optimizer, it complains that the problem
doesn't satisfy linearity conditions; because RAND() is a function so
it turns "b * X" to become non-linear!!!

I tried to go around this by creating another cell which copy and
value-paste the RAND() value into it. It solves the problem, but now I
have different problem: when RAND() value is copied and value-pased
and, by the time it is put in the new cell, the original cell which has
RAND() function changes its value.....and so on!!

How can I go around this correctly, so I keep the model linear and keep
RAND() values in both cells same?

Thanks,
Mike


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
RAND FUNCTION NADTARVIN Excel Worksheet Functions 1 September 29th 06 05:56 AM
HELP with the RAND() Function......AGAIN!!!!! denise1082 via OfficeKB.com Excel Worksheet Functions 9 July 31st 06 12:53 PM
HELP with the RAND() Function!!!!!! denise1082 Excel Worksheet Functions 15 July 31st 06 07:54 AM
RAND FUNCTION theo499 New Users to Excel 2 April 11th 06 05:08 AM
Rand function Susan Hayes Excel Worksheet Functions 3 August 18th 05 02:20 AM


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

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

About Us

"It's about Microsoft Excel"