Expand Minimize
This topic has not yet been rated - Rate this topic

XmlMappedRange.GoalSeek Method

Calculates the values necessary to achieve a specific goal.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
bool GoalSeek(
	Object Goal,
	Range ChangingCell
)

Parameters

Goal
Type: Object

The value you want returned in this cell.

ChangingCell
Type: Range

Specifies which cell should be changed to achieve the target value.

Return Value

Type: Boolean
true if the goal seek is successful; otherwise false.

If the goal is an amount returned by a formula, this calculates a value that, when supplied to your formula, causes the formula to return the number you want.

The following code example uses the GoalSeek method to find the cubic root of 27 and places the answer in cell A1. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerAddress1Cell with a corresponding schema element of type int.

private void SolveFormula()
{
    this.CustomerAddress1Cell.Formula = "=(A1^3)";
    this.CustomerAddress1Cell.GoalSeek(27, this.Range["A1"]);
}
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.