Calc offers the Subtotals tool as a more comprehensive alternative to the SUBTOTAL function. In contrast to SUBTOTAL, which only works on a single array, the Subtotals tool can create subtotals for up to three arrays arranged in labelled columns. It also groups subtotals by category and sorts them automatically, thereby eliminating the need to apply AutoFilters and filter categories by hand.
Choose Data - Subtotals.
To insert subtotal values into a worksheet:
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.
Choose Data - Subtotals to open the Subtotals dialogue box.
In the Group by drop-down list on the First Group 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.
In the Calculate subtotals for box on the First Group page, select a column containing values to be subtotaled. If you later change values in this column, Calc will automatically recalculate the subtotals.
In the Use function box on the First Group page, select a function to calculate the subtotals for the column selected in step 4.
Repeat steps 4 and 5 to create subtotals for other columns on the First Group page.
You can create two more subtotal categories by using the Second Group and Third Group 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 -”.
Click OK. Calc will add subtotal and grand total rows to your cell range.
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 (+) and minus (-) signs.
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.
To turn off outlines, choose Data - Group and Outline - Remove Outline. To reinstate them, choose Data - Group and Outline - AutoOutline.