Information functions
SHEETS
Matches all 6 recorded answers
Recorded: 6 workbook cells. How we measure this · See the Rust code
Local names in 40 languages
| Language | Name in Excel |
|---|---|
| Arabic | SHEETS |
| Bulgarian | SHEETS |
| Czech | SHEETS |
| Danish | ARK.FLERE |
| German | SHEETS |
| Greek | SHEETS |
| English (Australia) | SHEETS |
| English (United Kingdom) | SHEETS |
| English (United States) | SHEETS |
| Spanish | HOJAS |
| Estonian | SHEETS |
| Finnish | TAULUKOT |
| French | FEUILLES |
| Hebrew | SHEETS |
| Croatian | SHEETS |
| Hungarian | LAPOK |
| Indonesian | SHEETS |
| Italian | SHEETS |
| Japanese | SHEETS |
| Korean | SHEETS |
| Lithuanian | SHEETS |
| Latvian | SHEETS |
| Norwegian | ANTALL.ARK |
| Dutch | BLADEN |
| Polish | ARKUSZE |
| Portuguese (Brazil) | SHEETS |
| Portuguese (Portugal) | FOLHAS |
| Romanian | SHEETS |
| Russian | ЛИСТЫ |
| Slovak | SHEETS |
| Slovenian | SHEETS |
| Serbian (Latin) | LISTOVI |
| Swedish | ANTALBLAD |
| Thai | SHEETS |
| Turkish | SAYFALAR |
| Ukrainian | SHEETS |
| Vietnamese | SHEETS |
| Chinese (Simplified) | SHEETS |
| Chinese (Hong Kong) | SHEETS |
| Chinese (Traditional) | SHEETS |
Names from Microsoft's support site.
What it does
SHEETS([reference])
SHEETS([reference]) returns how many sheets a reference spans, or — with the argument
omitted — how many sheets the containing workbook has.
Microsoft's description is one line: "Returns the number of sheets in a reference." The argument description supplies the omitted case: "If Reference is omitted, SHEETS returns the number of sheets in the workbook that contains the function."
The quoted one-line description is Microsoft's text, from its support article https://support.microsoft.com/en-us/office/sheets-function-770515eb-e1e8-45ce-8066-b557e5e4b80b.
So the function has two quite different jobs depending on whether you give it an argument, and the two are worth separating:
SHEETS()— a workbook census. How many sheets exist.SHEETS(ref)— a span measurement. How many sheets this reference reaches across, which is1for an ordinary reference and larger only for a three-dimensional reference such asSheet1:Sheet3!A1(the value universe calls that a three-dimensional reference shape).SHEETS(Sheet1:Sheet3!A1)is3.
That second job is the one the function was really added for. Before dynamic arrays, a 3-D
reference was the only way a single argument could reach across sheets, and SHEETS is how a
formula finds out that it did.
The counting rule is documented and is the same as SHEET's: "SHEETS includes all worksheets
(visible, hidden, or very hidden) in addition to all other sheet types (macro, chart, or dialog
sheets)." A workbook showing three tabs can report 5.
Arguments
reference — optional, at most one. The published signature is SHEETS([reference]).
Unlike SHEET, this function takes only a reference. It does not accept a sheet name as
text: there is no "how many sheets does the sheet called X span" question to ask. That asymmetry
between the two siblings is easy to miss and is the source of most SHEETS errors.
The argument is a reference position, not a value position — the live reference must survive argument preparation, because the answer depends on the reference's shape, not on the values it designates.
The omitted form is a workbook-level query, not a caller-aware one in the coordinate sense: it
does not depend on which cell the formula is in, only on which workbook. That is why the declared
volatility is NonVolatile — the answer changes only when a sheet is added or removed, which is
a structural edit.
Try it
Quirks
Result and edge cases
Returns a Number — a count, minimum 1 for any valid reference.
- An ordinary reference is
1, whether it is a single cell, an area, or a structured reference; none of those spans sheets. - A 3-D reference returns the span size, counting every sheet between the endpoints in tab
order — which means hidden and chart sheets caught inside the span are counted too, by the
documented counting rule. A
Sheet1:Sheet3span in a workbook with a hidden sheet between them is3, not2, and the hidden sheet's cells participate in whatever the 3-D reference is doing. That is a real workbook hazard, andSHEETSis how you detect it. - A multi-area reference spanning two sheets (
(Sheet1!A1, Sheet2!A1)) — not addressed by the documentation, not established here. Whether it counts 2, counts 1, or errors is open. - An external-workbook reference — whose sheet count is being returned, and does it differ when the source workbook is closed? Not addressed, not established.
SHEETSis not available in the object model. Microsoft says so explicitly: "SHEETS is not available in the Object Model (OM) because the Object Model already includes similar functionality." Automation code should readWorkbook.Sheets.Count.
Errors
#REF!— documented: "If reference is not a valid value, SHEETS returns the #REF! error value."
Note the difference from SHEET, which has two documented errors because it has two argument
forms. SHEETS takes only references, so it has only the reference error. There is no #N/A
path, because there is no name lookup to fail.
#NAME? would arise before SHEETS runs, from an unresolvable defined name, in reference
resolution (coercion and lifting).
Arity failure (two or more arguments) is expected to be refused at formula entry rather than evaluated (the call pipeline).
How to implement
Notes for implementers
- Count every sheet type, including hidden, very hidden, chart, macro and dialog sheets. An implementation that enumerates visible worksheets will under-report, silently and workbook-dependently.
- The argument's shape is the subject.
SHEETSmust inspect the reference's sheet span, not dereference it. A values-only path cannot implement this function at all. - Do not accept a text sheet name.
SHEETdoes;SHEETSdoes not. Adding it for symmetry would be a divergence. SHEETS()andSHEETS(ref)are different queries — a workbook census and a span measurement. Model them separately rather than passing a null reference into one code path.- Decide the multi-area and external-reference cases explicitly and record them as decisions awaiting evidence.
Rust code
Show the CalcFunc source of this function
Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.
SHEETS · 1 lines · calc-func/src/catalogue/host_facts.rs on GitHub4 sheets_fn "SHEETS" (0, 1) [R "reference"] |s, a, sv| { sheets(s, a, sv) }
sheets · 23 lines · calc-func/src/catalogue/host_facts.rs on GitHubfn sheets(site: &Site<'_>, a: &[CalcValue], sv: &mut EvalServices<'_>) -> Step<CalcValue> {
if !a.is_empty() && !a[0].is_missing() {
// The sheets the reference spans: one, or each sheet of a 3-D reference (L3, dc-m3u;
// Excel 16.0, 2026-10-23: `=SHEETS(Ja:Ma!A1)` is 3).
if let CoreRef::Reference(reference) = a[0].core_ref() {
let mut sheets: Vec<_> = reference.areas().iter().map(|area| area.sheet()).collect();
sheets.sort();
sheets.dedup();
return site.number(sheets.len() as f64);
}
// A value that is no reference is #N/A, an error value the result (Excel 16.0.20430,
// 2026-10-25, dc-6au: `=SHEETS(1)`, `=SHEETS("a")`, `=SHEETS({1,2})` and
// `=SHEETS(A1:A3*1)` are #N/A, `=SHEETS(#REF!)` #REF!).
return match a[0].core_ref() {
CoreRef::Error(code) => fail(code),
_ => fail(WorksheetErrorCode::NA),
};
}
match sv.host().and_then(|host| host.sheet_count()) {
Some(count) => site.number(f64::from(count)),
None => Err(site.not_modelled(None)),
}
}
Kernels shared with other functions
first_cellcatalogue/host_factscell_valuecatalogue/host_factscolumn_letterscatalogue/host_factsfactscatalogue/host_factsqualified_sheetcatalogue/host_factscellcatalogue/host_factss_numbercatalogue/host_factsinfocatalogue/host_factssheetcatalogue/host_factssectionsformat/cell_infotokensformat/cell_infois_date_timeformat/cell_infodate_time_classformat/cell_infoplacesformat/cell_infonumber_classformat/cell_infoclassifyformat/cell_infosplit_prefixported/a1_refsparse_cell_tokenported/a1_refsparse_column_tokenported/a1_refsparse_row_tokenported/a1_refsparse_a1_referenceported/a1_refsaddress_name_characterported/addressaddress_name_is_referenceported/addressquote_sheet_text_if_neededported/address
Argument and result plumbing
failcatalogue/kitgridcatalogue/kittext_argcatalogue/kittext_valuecatalogue/kit
No implementation has been published with a Handbook test suite for this function.
Version differences
No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.
Alternatives
Relationships
SHEET([reference])is the index toSHEETS' count. Same module, same 2013 vintage, same documented counting rule, routinely confused. Mnemonic: singular returns a position, plural returns a quantity. Note also thatSHEETaccepts a text sheet name andSHEETSdoes not.INFO("numfile")counts worksheets across all open workbooks;SHEETS()counts within the containing workbook. Two different numbers that are equal only when one file is open.AREAS(reference)counts the areas in a multi-area reference the waySHEETScounts the sheets in a 3-D one. They are the two cardinality functions over reference shape, they share an implementation module, and together they characterise a reference's geometry.ROWSandCOLUMNScomplete the set:ROWS,COLUMNS,SHEETSandAREASare the four functions that measure a reference instead of reading it.CELL,INFO,ISFORMULA,FORMULATEXTare the other host-backed Information functions.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents