This article describes the formula syntax and use of the SHEET function in Microsoft Excel.
Description
The SHEET function returns the sheet number of the specified sheet or other reference.
Syntax
SHEET(value)
The SHEET function syntax uses only the one following argument.
-
value Optional argument. Use this to specify the name of a sheet or a reference for which you want to obtain the sheet number. Otherwise, the function will return the number of the sheet containing the SHEET function.
Remarks
-
SHEET locating/identification capability includes all worksheets (visible, hidden, or very hidden) in addition to all other sheet types (macro, chart, or dialog sheets).
-
If the value argument is not a valid reference, SHEET returns the #REF! error. For example, =SHEET(Sheet1!#REF) will return the #REF! error value.
-
If the value argument is not a valid sheet name, SHEET returns the #NA error value. For example, =SHEET(“badSheetName”) will return the #NA error value.
-
SHEET is not available in the Object Model (OM) because the Object Model already includes similar functionality.
Example
Copy the following entire table and paste it in cell A1 (and adjacent) of a new Excel worksheet. If you do not automatically see the results, select formula, press F2 and press Enter. Adjust column widths if needed to see everything.
Formula |
Function (or failure) |
Result |
---|---|---|
=SHEET(QSalesByRegion) |
Finds the number of the sheet called QSalesByRegion (having a scope that makes it available to the entire workbook). |
2 |
=SHEET(Table1) |
Finds the sheet number containing the table named Table1... (who's scope makes it available to the entire workbook). |
2 |
=SHEET(Hi_Temps) |
Returns the #NAME? error value because the sought name Hi_Temps is limited to the worksheet that contains it. |
#NAME? |
=SHEET("Stuff") |
Seeks and returns the sheet number (3) of the worksheet named Stuff. |
3 |