[]
You can use the GoalSeek method to find a value that will produce the desired result for a formula. An approximation is acceptable. You can set the starting and intended goal of the calculation.
Use the GoalSeek method to find the required result.
In this example the formula is in cell (1,1). The result that you want to see in the formula cell is 32. The value in C1 is what is required to get a result of 32.
fpSpread1.Sheets[0].Cells[1, 1].Formula = "C1+D1";
fpSpread1.Sheets[0].Cells[0, 3].Value = 2;
fpSpread1.GoalSeek(0, 0, 2, 0, 1, 1, 32);<
fpSpread1.Sheets(0).Cells(1, 1).Formula = "C1+D1"
fpSpread1.Sheets(0).Cells(0, 3).Value = 2
fpSpread1.GoalSeek(0, 0, 2, 0, 1, 1, 32)
Specifying a Cell Reference in a Formula
Specifying a Sheet Reference in a Formula
Specifying an External Reference in a Formula
Using a Circular Reference in a Formula
Nesting Functions in a Formula
Recalculating and Updating Formulas Automatically
Allowing the User to Enter Formulas
Creating and Using a Custom Name
Creating and Using a Custom Function
Creating and Using External Variable
Working with the Formula Text Box