# GrapeCity.Spreadsheet.IRange.GoalSeek

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Spreadsheet_IRange_GoalSeek_" data-uid="GrapeCity.Spreadsheet.IRange.GoalSeek*">GoalSeek Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Spreadsheet_IRange_GoalSeek_" data-uid="GrapeCity.Spreadsheet.IRange.GoalSeek*"></a>
<h4 id="GrapeCity_Spreadsheet_IRange_GoalSeek_System_Double_GrapeCity_Spreadsheet_IRange_System_Boolean_" data-uid="GrapeCity.Spreadsheet.IRange.GoalSeek(System.Double,GrapeCity.Spreadsheet.IRange,System.Boolean)">GoalSeek(double, IRange, bool)</h4>
<div class="markdown level1 summary"><p>Calculates the values necessary to achieve a specific goal.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">bool GoalSeek(double goal, IRange changingCell, bool changeIfFound = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function GoalSeek(goal As Double, changingCell As IRange, Optional changeIfFound As Boolean = False) As Boolean</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><span class="parametername">goal</span></td>
      <td><p>The value you want returned in this cell.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.IRange.html">IRange</a></td>
      <td><span class="parametername">changingCell</span></td>
      <td><p>Specifies which cell should be changed to achieve the target value.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">changeIfFound</span></td>
      <td><p>if set to <code>true</code>, the <code class="paramref">changingCell</code>'s value is changed only if the goal seek is successful.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p><code>true</code> if the goal seek is successful, <code>false</code> otherwise.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Spreadsheet_IRange_GoalSeek_System_Double_GrapeCity_Spreadsheet_IRange_System_Boolean__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>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.</p>
</div>


<a id="GrapeCity_Spreadsheet_IRange_GoalSeek_" data-uid="GrapeCity.Spreadsheet.IRange.GoalSeek*"></a>
<h4 id="GrapeCity_Spreadsheet_IRange_GoalSeek_System_Double_System_String_System_Boolean_" data-uid="GrapeCity.Spreadsheet.IRange.GoalSeek(System.Double,System.String,System.Boolean)">GoalSeek(double, string, bool)</h4>
<div class="markdown level1 summary"><p>Calculates the values necessary to achieve a specific goal.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">bool GoalSeek(double goal, string changingCell, bool changeIfFound = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function GoalSeek(goal As Double, changingCell As String, Optional changeIfFound As Boolean = False) As Boolean</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><span class="parametername">goal</span></td>
      <td><p>The value you want returned in this cell.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">changingCell</span></td>
      <td><p>Specifies which cell should be changed to achieve the target value.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">changeIfFound</span></td>
      <td><p>if set to <code>true</code>, the <code class="paramref">changingCell</code>'s value is changed only if the goal seek is successful.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p><code>true</code> if the goal seek is successful, <code>false</code> otherwise.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Spreadsheet_IRange_GoalSeek_System_Double_System_String_System_Boolean__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>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.</p>
</div>


<a id="GrapeCity_Spreadsheet_IRange_GoalSeek_" data-uid="GrapeCity.Spreadsheet.IRange.GoalSeek*"></a>
<h4 id="GrapeCity_Spreadsheet_IRange_GoalSeek_System_Double_GrapeCity_Spreadsheet_CellReference_System_Boolean_" data-uid="GrapeCity.Spreadsheet.IRange.GoalSeek(System.Double,GrapeCity.Spreadsheet.CellReference,System.Boolean)">GoalSeek(double, CellReference, bool)</h4>
<div class="markdown level1 summary"><p>Calculates the values necessary to achieve a specific goal.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">bool GoalSeek(double goal, CellReference changingCell, bool changeIfFound = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function GoalSeek(goal As Double, changingCell As CellReference, Optional changeIfFound As Boolean = False) As Boolean</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><span class="parametername">goal</span></td>
      <td><p>The value you want returned in this cell.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.CellReference.html">CellReference</a></td>
      <td><span class="parametername">changingCell</span></td>
      <td><p>Specifies which cell should be changed to achieve the target value.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">changeIfFound</span></td>
      <td><p>if set to <code>true</code>, the <code class="paramref">changingCell</code>'s value is changed only if the goal seek is successful.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p><code>true</code> if the goal seek is successful, <code>false</code> otherwise.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Spreadsheet_IRange_GoalSeek_System_Double_GrapeCity_Spreadsheet_CellReference_System_Boolean__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>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.</p>
</div>
</div>
