Solver normally requires a final value for it to solve for. Since this
is not quite what you are wanting, then you will have to write a
routine to do this search. I created a workbook, just for fun, that
employs the "Golden Section" search method that I remember from
college many years ago. The code is a little over 100 lines, so is a
little big to post here, but I will send it to you for you to look
over. I included some extra "goodies" also: a separate worksheet to
"log" each value of the iteration, and a chart sheet to plot the
points.
You need to give the routine an upper and a lower limit for the values
in cell A1, so I put those in cells A2 and A3. It uses a button to
start the macro, rather than automatically calling the routine from
the worksheet Change event, but you could add this call very easily.
This allows one to enter various values in cell A1 to verify the
formula in cell C1, then push the button to find the value of A1 that
will maximize the value of C1. I used a parabola for the function in
cell C1. Just change cell C1 to your function.
|