Spread ASP.NET 6.0 Product Documentation
GoalSeek Method
See Also  Example Send Feedback
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > FpSpread Class : GoalSeek Method


variableSheet
Sheet index of cell that contains value to adjust
variableRow
Row index of cell that contains to adjust
variableColumn
Column index of cell that contains value to adjust
formulaSheet
Sheet index of cell that contains formula
formulaRow
Row index of cell that contains formula
formulaColumn
Column index of cell that contains formula
desiredResult
Formula result you wish to achieve

Glossary Item Box

Attempt to find value for one cell that will produce desired formula result in another cell.

Syntax

Visual Basic (Declaration) 
Public Function GoalSeek( _
   ByVal variableSheet As Integer, _
   ByVal variableRow As Integer, _
   ByVal variableColumn As Integer, _
   ByVal formulaSheet As Integer, _
   ByVal formulaRow As Integer, _
   ByVal formulaColumn As Integer, _
   ByVal desiredResult As Double _
) As Boolean
Visual Basic (Usage)Copy Code
Dim instance As FpSpread
Dim variableSheet As Integer
Dim variableRow As Integer
Dim variableColumn As Integer
Dim formulaSheet As Integer
Dim formulaRow As Integer
Dim formulaColumn As Integer
Dim desiredResult As Double
Dim value As Boolean
 
value = instance.GoalSeek(variableSheet, variableRow, variableColumn, formulaSheet, formulaRow, formulaColumn, desiredResult)
C# 
public bool GoalSeek( 
   int variableSheet,
   int variableRow,
   int variableColumn,
   int formulaSheet,
   int formulaRow,
   int formulaColumn,
   double desiredResult
)

Parameters

variableSheet
Sheet index of cell that contains value to adjust
variableRow
Row index of cell that contains to adjust
variableColumn
Column index of cell that contains value to adjust
formulaSheet
Sheet index of cell that contains formula
formulaRow
Row index of cell that contains formula
formulaColumn
Column index of cell that contains formula
desiredResult
Formula result you wish to achieve

Return Value

true if value is found, false otherwise

Example

This example uses the GoalSeek method.
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);

Visual BasicCopy 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)

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2002-2012 GrapeCity, Inc. All Rights Reserved.