Contact

SHEETS Function (Gnumeric)

Lookup Intermediate Gnumeric

Count sheets in a Gnumeric workbook or reference span with SHEETS, including the no-argument workbook count and the distinction from counting populated cells.

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

SHEETS returns how many sheets are covered by a supplied reference, or how many sheets are in the workbook when called without an argument. It counts sheet structure, not cells containing data. A large range on one sheet still belongs to one sheet.

Syntax and defaults

=SHEETS([reference])

reference is optional. Omitting it makes the inspected callback call the workbook’s sheet-count routine. A single-sheet cell range returns 1. For a range whose two endpoints explicitly name different sheets, the source calculates the inclusive distance between their positions in the workbook: absolute index difference plus one. Thus the count depends on sheet order and the referenced span, not on how much data appears within it.

An array occupies one sheet for this count. Do not substitute ROWS or COLUMNS when the intended question is the number of worksheet tabs: those functions measure a range’s row or column dimensions instead.

Reproducible four-sheet fixture

Create a new workbook containing exactly four sheets, named Regression, ChiTest, Workday and SafeLookup. On SafeLookup enter =SHEETS(). The expected result is 4. In the tested headless Gnumeric 1.12.57 fixture it returned exactly 4.

On that same sheet, =SHEETS(A1:B2) returned 1, including when those four cells were empty. The range covers two rows and two columns but only one sheet. This supplies an independent structural check: workbook count 4, reference-sheet count 1. No assumption about a new workbook’s default sheet count is needed because the fixture explicitly fixes it.

If you manually add another sheet and recalculate, the no-argument form should count the new workbook structure. That follows the inspected implementation but was not separately executed here. The ordinary single-sheet range still refers to one sheet. Use explicit workbook structure when documenting expected results rather than assuming every installation starts with the same number of tabs.

Important documented-error discrepancy

The function help says a non-array, non-reference, non-range argument returns #VALUE!. The inspected 1.12.57 and 1.12.62 callbacks instead return 1 for a supplied non-range value. A targeted 1.12.57 native test confirmed =SHEETS(42) returns 1. This guide therefore does not repeat the help’s error promise as observed behavior.

Use references or the no-argument form for portable work. A numeric scalar is a useful diagnostic of the discrepancy, not a recommended way to count sheets. The single native result is not a certification of every scalar coercion, embedded error, or invalid reference combination.

Advanced application: checking workbook structure

A template can show the expected sheet count beside =SHEETS() to help catch an accidentally added or removed tab. This is a lightweight check, not a complete integrity test: renaming a tab or changing its data may leave the count unchanged. Likewise, a three-dimensional reference span is sensitive to sheet order; inserting a sheet between the endpoints can enlarge the span.

The source uses inclusive endpoint indices, but this guide has not certified a particular textual 3-D reference syntax through the GUI. Build and validate such a reference in your actual workbook before relying on it. Avoid treating a count of 1 from a scalar as evidence that the scalar names a valid worksheet.

Troubleshooting, history and evidence

If a workbook-wide result seems too small, inspect the actual file being recalculated and ensure it includes all intended sheets. If a range gives 1, remember that cell area and sheet span are different dimensions. XLSX export in the native test wrote SHEETS with the _xlfngnumeric.SHEETS extension spelling; this records format serialization, not a universal alias guarantee for other products.

SHEETS is registered in the inspected official 1.12.57 and retained 1.12.62 sources. NEWS introduces SHEETS among the ODF compatibility functions added in Gnumeric 1.9.15 and records a leak fix in 1.10.16. A last functioning release is not established by the bounded tests here. Source material for 1.12.62 was retained October 13–14, 2026; 1.12.57 source and bounded headless native results were checked October 17. The screenshot below shows the selected workbook-count example in the actual 1.12.57 application; no 1.12.62 runtime test is claimed.

Native application screenshot

Gnumeric SHEETS example with formula bar and calculated result

Gnumeric 1.12.57, captured October 17, 2026. Selected cell B4 shows the documented formula result 4. The formula bar and synthetic inputs are visible; GUI locale was not independently recorded.