[]
        
(Showing Draft Content)

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.

Using Code

Use the GoalSeek method to find the required result.

Example

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)

See Also

Formulas in Cells

Placing a Formula in Cells

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

Using the Array Formula

Working with the Formula Text Box

Setting up the Name Box

Using Language Package

Accessing Data from Header or Footer

Managing External Reference

Working With Dynamic Array Formulas