Spread Windows Forms 10.0 Product Documentation > Developer's Guide > Customizing Interaction in Cells > Managing Formulas in Cells > Finding a Value Using GoalSeek |
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.
C# |
Copy Code
|
---|---|
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);<
|
VB |
Copy Code
|
---|---|
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)
|