Contact

SUBTOTAL Function in Gnumeric: Syntax, Examples and Compatibility

Math Beginner Gnumeric

Use SUBTOTAL in Gnumeric. Summarize a range with a numbered calculation and avoid counting nested SUBTOTAL cells twice. Includes native 1.12.57 examples and version-scoped 1.12.62 source checks.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: Summarize a range with a numbered calculation and avoid counting nested SUBTOTAL cells twice.

Evidence boundary: The examples explicitly labelled native below were calculated in Gnumeric 1.12.57 on October 18, 2026. The argument explanations also cite pinned 1.12.62 source and the official manual. There was no native 1.12.62 run, and these cases do not certify every release, locale or file-import scenario.

Availability and version history

  • Introduced: Documented by 1.12.62; original introduction not established.
  • Availability: Supported in Gnumeric 1.12.62, based on the function-specific registration.
  • Scope: Desktop; the fn-stat function module must be included and enabled.
  • Checked: October 18, 2026. Bounded native 1.12.57 run; pinned 1.12.62 source reviewed separately. Original introduction remains unestablished.

Syntax and calculation codes

=SUBTOTAL(function_num, ref1, [ref2], ...)

The first argument chooses the calculation; subsequent arguments supply values or ranges. Gnumeric’s documented table is:

Code Calculation Meaning
1 AVERAGE Arithmetic mean
2 COUNT Numeric count
3 COUNTA Nonempty count
4 MAX Largest value
5 MIN Smallest value
6 PRODUCT Product
7 STDEV Sample standard deviation
8 STDEVP Population standard deviation
9 SUM Sum
10 VAR Sample variance
11 VARP Population variance

Do not add 100 to these codes to request a different hidden-row policy. The 1.12.62 implementation accepts only codes 1–11; the tested 1.12.57 formulas with 101 and 109 both returned #NUM!.

Worked example: sum and average

Enter the numbers 10, 20, 30, 40 into B2:B5, respectively. Keep all rows visible.

=SUBTOTAL(9,B2:B5)
=SUBTOTAL(1,B2:B5)

The native results were 100 and 25: 10 + 20 + 30 + 40 = 100, and 100 / 4 = 25. Enter formulas outside B2:B5 so a result does not become its own input.

Worked example: a subtotal inside the range

Put =SUBTOTAL(9,B2:B5) in B6. It displays 100. Then compare:

=SUBTOTAL(9,B2:B6)
=SUM(B2:B6)

The outer SUBTOTAL returned 100, while ordinary SUM returned 200. The first formula excludes the nested subtotal instead of adding it to its underlying records. The 1.12.62 implementation explicitly collects values with its nested-subtotal exclusion flag.

This is useful when a report contains both detail records and intermediate subtotal formulas. A manually typed number 100 is still an ordinary number: do not replace the subtotal formula with its value and assume the exclusion will survive.

Hidden rows, filters and errors

Nested-subtotal exclusion and row visibility are separate questions. This guide’s native fixture did not apply a filter or manually hide rows, so it does not promise that SUBTOTAL excludes either kind of hidden row. Test the exact visibility operation in your installed release before relying on a visible-only report total.

  • =SUBTOTAL(109,B2:B5) returned #NUM!.
  • =SUBTOTAL(101,B2:B5) returned #NUM!.
  • Choose 9 for a sum and 1 for a mean; changing the code changes the operation, not just the display.
  • COUNT and COUNTA are different operations. This fixture contains only numbers and does not test blanks, logical values, text or error cells.

Compatibility

The vendor manual uses a broad Excel-compatibility label, but it does not override the concrete 1–11 code table or native 100-series errors. An imported formula using 109 needs review. Do not silently change it to 9 if the original workbook depended on hidden-row exclusion: first establish the intended reporting rule.

Native screenshot and calculation evidence

Gnumeric 1.12.57 showing SUBTOTAL input values, formulas and calculated results

The image is an unmodified capture of the actual Gnumeric window opening the cache-free fixture. The formula-text column is a reading aid; the result column contains live formulas. The fixture was also recalculated and saved by ssconvert 1.12.57 through Gnumeric’s native workbook format, then read back as XLSX to inspect its formulas and values. The screenshot is from the GUI opening the original fixture; it is not a screenshot of a different application or a constructed illustration.

Formula examples use English function names and comma argument separators. Entry separators can vary with locale; the native run does not establish other locale conventions.

Editorial verification: Cache-free input formulas, native-saved formula/value readback, actual errors and raw screenshots were retained for these bounded cases. Source/manual checks and runtime results remain version-separated. See the editorial testing standards for the evidence policy.