This article describes the formula syntax and usage of the SHEETS  function in Microsoft Excel.

Description

Returns the number of sheets in a reference.

Syntax

SHEETS(reference)

The SHEETS function syntax has the following arguments.

  • Reference    Optional. Reference is a reference for which you want to know the number of sheets it contains. If Reference is omitted, SHEETS returns the number of sheets in the workbook that contains the function.

Remarks

  • SHEETS includes all worksheets (visible, hidden, or very hidden) in addition to all other sheet types (macro, chart, or dialog sheets).

  • If reference is not a valid value, SHEETS returns the #REF! error value.

  • SHEETS is not available in the Object Model (OM) because the Object Model already includes similar functionality.

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Formula

Description

Result

=SHEETS()

Because there is no Reference argument specified, the total number of sheets in the workbook is returned (3).

3

=SHEETS(My3DRef)

Returns the number of sheets in a 3D reference with the defined name My3DRef, which includes Sheet2 and Sheet3 (2).

2

Top of Page

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.