View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
murthy murthy is offline
external usenet poster
 
Posts: 24
Default Excel Solver as User Defined Funcntion

Hi Dana:

Thank you very much. I appreciate your solution. I am getting close to what
I want. I hope and wish you could be of more help to me.
The problem is set up like this:
Total 10 constraints. 5 set of constraints (X6:X10) - which I want to vary
to see how my objective value(X11) changes. X11 is the 'sumproduct' of
changing cells (B5:R5) and the objective value (B12:R12). I have setup the
solver and I have a correct solution for the base case.
Now I want to change (X6:X10) and see the resulting value of Objective
(X11). Getting X11 automatically as I enter X6:X10 is the problem in question.
I am naive to programming and I dont know how to solve this.
If there is a way to send my file as attachment it would be great. Can you
please let me know if I can paste a screenshot?

Kind Regards.


"Dana DeLouis" wrote:

question is whether we can define a UDF that invokes a solver?


Hi. Internally, Solver is a Subrotine, so one can not call it like a
regular function, if that is what you mean.
If you take the above question literally, then "yes", with some setup
involved.
Solver's subroutines interact with the spreadsheet. You need to set up
everything first on a spreadsheet.
For Example, you must have a Target Cell, and have Changing cells.
One would never really program it as a function. The usualy way to to run a
Sub, find a soluion, and if desired, copy the soluion to a desired location.
Depending on what you are doing, does anything here give you any ideas??
Again, you must set up solver first.

Sub Demo()
[A1] = SolverSolution
End Sub

Function SolverSolution()
Dim Chk As Long
' Set up Solver...then
Chk = SolverSolve(True)
' If Chk is valid...then
SolverSolution = [Target]
End Function

--
HTH :)
Dana DeLouis
Windows XP & Office 2007


"Murthy" wrote in message
...
Thanks for getting back to me. What I want is close to this. But still my
question is whether we can define a UDF that invokes a solver?

Regards.

"Gary''s Student" wrote:

see:


http://groups.google.com/group/micro...0b795e4792216f



--
Gary''s Student
gsnu200708


"Murthy" wrote:

Hi all:

Can someone give me an idea of how to define excel solver as an user
defined
function? Say A3 = CallSolver(Inputs, Retrun Output)... something in
those
lines.

Regards.