<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
<!--
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
-->

<meta>
  <topic id="usingsubtotaltooltopic" indexer="include" status="PUBLISH">
    <title id="tit" xml-lang="en-US">Using Subtotals Tool</title>
    <filename>/text/scalc/guide/subtotaltool.xhp</filename>
  </topic>
</meta>
<body>
<bookmark xml-lang="en-US" branch="index" id="bm_id521585182060496">
    <bookmark_value>subtotals;using subtotals tool</bookmark_value>
</bookmark>
<section id="usingsubtotal">
    <h1 id="hd_id631585177069332"><variable id="subtotaltoolh1"><link href="text/scalc/guide/subtotaltool.xhp">Using Subtotal Tool</link></variable></h1>
    <paragraph id="par_id301585177069332" role="paragraph">Calc offers the Subtotals tool as a more comprehensive alternative to the <link href="text/scalc/01/04060106.xhp#Section12">SUBTOTAL function</link>. In contrast to SUBTOTAL, which only works on a single array, the Subtotals tool can create subtotals for up to three arrays arranged in labeled columns. It also groups subtotals by category and sorts them automatically, thereby eliminating the need to apply AutoFilters and filter categories by hand.</paragraph>
</section>
<section id="howtoget">
    <embed href="text/scalc/00/00000412.xhp#dntegs"/>
</section>
<h2 id="hd_id891585177511329">Using the Subtotals tool</h2>
<paragraph role="paragraph" id="par_id91585177517697">To insert subtotal values into a worksheet:</paragraph>
  <list type="ordered">
        <listitem>
        <paragraph id="par_id241585177550504" role="listitem">Select the cell range for the subtotals that you want to calculate, and remember to include the column heading labels. Alternatively, click on a single cell within your data to allow Calc to automatically identify the range.</paragraph>
    </listitem>
    <listitem>
        <paragraph id="par_id421585177574387" role="listitem">Choose <menuitem>Data - Subtotals</menuitem> to open the Subtotals dialog.</paragraph>
    </listitem>
    <listitem>
      <paragraph id="par_id41585177608508" role="listitem">In the <emph>Group by</emph> drop-down list on the <emph>First Group</emph> page, select a column by its label. Entries in the cell range from step 1 will be grouped and sorted by matching values in this column.</paragraph>
    </listitem>
    <listitem>
        <paragraph id="par_id451585177625978" role="listitem">In the <emph>Calculate subtotals for</emph> box on the <emph>First Group</emph> page, select a column containing values to be subtotaled. If you later change values in this column, Calc will automatically recalculate the subtotals.</paragraph>
    </listitem>
    <listitem>
      <paragraph id="par_id661585177644535" role="listitem"> In the <emph>Use function</emph> box on the <emph>First Group</emph> page, select a function to calculate the subtotals for the column selected in step 4.</paragraph>
    </listitem>
    <listitem>
        <paragraph id="par_id351585177661529" role="listitem">Repeat steps 4 and 5 to create subtotals for other columns on the <emph>First Group</emph> page.</paragraph>
    </listitem>
    <listitem>
        <paragraph id="par_id511585177679372" role="listitem">You can create two more subtotal categories by using the <emph>Second Group</emph> and <emph>Third Group</emph> pages and repeating steps 3 to 6. If you do not want to add more groups, then leave the Group by list for each page set to “- none -”.</paragraph>
    </listitem>
    <listitem>
        <paragraph id="par_id301585177698777" role="listitem">Click <emph>OK</emph>. Calc will add subtotal and grand total rows to your cell range.</paragraph>
    </listitem>
</list>
<h2 id="hd_id211585178799496">Subtotal outline</h2>
<paragraph role="paragraph" id="par_id841585178819108">
When you use the Subtotals tool, Calc inserts an outline to the left of the row number column. This outline represents the hierarchical structure of your subtotals, and can be used to hide or show data at different levels in the hierarchy using the numbered column indicators at the top of the outline or the group indicators, denoted by plus <emph>(+)</emph> and minus <emph>(-)</emph> signs.</paragraph>
<paragraph role="paragraph" id="par_id371585181820075">This feature is useful if you have many subtotals, as you can simply hide low-level details, such as individual entries, to produce a high-level summary of your data.</paragraph>
<paragraph role="paragraph" id="par_id161585178829165">To turn off outlines, choose <menuitem>Data - Group and Outline - Remove Outline</menuitem>. To reinstate them, choose <menuitem>Data - Group and Outline - AutoOutline</menuitem>.</paragraph>
<section id="relatedtopics">
<embed href="text/scalc/01/12050000.xhp#subtotalheaderh1"/>
</section>
</body>
</helpdocument>
