Forum Discussion
Exporting mathematical model in Excel into a script
- Apr 13, 2021Formula from Excel to text file is possible to be exported/copied using VBA macro. VBA works like other programming languages,, has enough capacity also. You need to work in either way ,, read value from sheet or input through User Form,,, ultimately it needs values to be calculated.
First let me tell you that SOLVER finds an optimal value either maximum or minimum, for formula called the objective cell,, subject to constraints, on the values of other formula cells on a worksheet.
In your case solver hardly works,,, Coz for the Vapor & Mass are independent values (what I found in the Example WB).
If you can handle VBA then I may suggest you method to use Excel formula with VBA code,,, another possibility is using the recently launched LAMBDA,, provides a way to create a custom function, helps to use with Math/Physics base equation in Excel.
Rajesh:
Thank you for your answer.
Indeed, I could try solving it in Excel.
The goal is to make the solver value minimal (tending to zero).
However, my goal is to export the equations into a script.
mass = vapor + liquid
Vapor/MW * R * T = P * V_vapor
...
Do you have any comments with these regards?
I would appreciate it.
Have a good day.
Thank you.
- Rajesh_SinhaApr 12, 2021Iron ContributorSince Excel uses only cell reference then either you may use cell references or NAME assigned to the cell while using the Formula.
And in case of Excel VBA macro R, T & P should be Variables.- Enrique_Garcia_FrancoApr 12, 2021Copper ContributorThank you.
And how could I export all formulas into a text file?
It is a matter of VBA reading cell by cell and copying what has been typed, I guess.
Thank you.
Regards.- Rajesh_SinhaApr 13, 2021Iron ContributorFormula from Excel to text file is possible to be exported/copied using VBA macro. VBA works like other programming languages,, has enough capacity also. You need to work in either way ,, read value from sheet or input through User Form,,, ultimately it needs values to be calculated.