Friday, April 23, 2021

Sheet function

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

Description

Returns the sheet number of the reference sheet.

Syntax

SHEET(value)

The SHEET function syntax has the following arguments.

  • Value    Optional. Value is the name of a sheet or a reference for which you want the sheet number. If value is omitted, SHEET returns the number of the sheet that contains the function.

Remarks

  • SHEET 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 value, SHEET returns the #REF! error value. For example, =SHEET(Sheet1!#REF) will return the #REF! error value.

  • If the value argument is a sheet name that is not valid, 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 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

=SHEET(QSalesByRegion)

Returns the sheet number that contains the defined name QSalesByRegion on Sheet2, and has a scope that makes it available to the entire workbook.

2

=SHEET(Table1)

Returns the sheet number that contains the table named Table1 on Sheet2, and has a scope that makes it available to the entire workbook.

2

=SHEET(Hi_Temps)

Returns the #NAME? error value because the defined name Hi_Temps is limited to the worksheet that contains it, Sheet2.

#NAME?

=SHEET("Stuff")

Returns the sheet number of the worksheet named Stuff.

3

Top of Page

No comments:

Post a Comment