# GrapeCity.Documents.Excel.IRange.Subtotal

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Excel_IRange_Subtotal_" data-uid="GrapeCity.Documents.Excel.IRange.Subtotal*">Subtotal Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Excel_IRange_Subtotal_" data-uid="GrapeCity.Documents.Excel.IRange.Subtotal*"></a>
<h4 id="GrapeCity_Documents_Excel_IRange_Subtotal_System_Int32_GrapeCity_Documents_Excel_ConsolidationFunction_System_Collections_Generic_IEnumerable_System_Int32__System_Boolean_System_Boolean_GrapeCity_Documents_Excel_SummaryRow_" data-uid="GrapeCity.Documents.Excel.IRange.Subtotal(System.Int32,GrapeCity.Documents.Excel.ConsolidationFunction,System.Collections.Generic.IEnumerable{System.Int32},System.Boolean,System.Boolean,GrapeCity.Documents.Excel.SummaryRow)">Subtotal(int, ConsolidationFunction, IEnumerable&lt;int&gt;, bool, bool, SummaryRow)</h4>
<div class="markdown level1 summary"><p>Creates subtotals for the range.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">void Subtotal(int groupBy, ConsolidationFunction subtotalFunction, IEnumerable&lt;int&gt; totalList, bool replace = true, bool pageBreaks = false, SummaryRow summaryRowLocation = SummaryRow.Below)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Sub Subtotal(groupBy As Integer, subtotalFunction As ConsolidationFunction, totalList As IEnumerable(Of Integer), Optional replace As Boolean = True, Optional pageBreaks As Boolean = False, Optional summaryRowLocation As SummaryRow = SummaryRow.Below)</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.int32">int</a></td>
      <td><span class="parametername">groupBy</span></td>
      <td><p>The field to group by, as a one-based integer offset.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Excel.ConsolidationFunction.html">ConsolidationFunction</a></td>
      <td><span class="parametername">subtotalFunction</span></td>
      <td><p>The subtotal function.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>&gt;</td>
      <td><span class="parametername">totalList</span></td>
      <td><p>An array of 1-based field offsets, indicating the fields to which the subtotals are added.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">replace</span></td>
      <td><p>True to replace existing subtotals. The default value is True.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">pageBreaks</span></td>
      <td><p>True to add page breaks after each group. The default value is False.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Excel.SummaryRow.html">SummaryRow</a></td>
      <td><span class="parametername">summaryRowLocation</span></td>
      <td><p>Places the summary data relative to the subtotal.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
