SHEETS([reference])

Returns the number of sheets in a reference.

reference(Optional) The formula reference.

Remarks

* Added in Excel 2013.
* If "reference" is not provided, then the total number of sheets in the workbook is returned.
* This function includes all worksheets (visible, hidden, very hidden, chart, dialog sheets, macro sheets).
* This function cannot be called from VBA.
* If "reference" is not valid, then #REF is returned.
* For the Microsoft documentation refer to support.office.com

 A
1=SHEETS() = 5
2=SHEETS(Sheet1!A1) = 1
3=SHEETS(Sheet1:Sheet1!A1) = 1
4=SHEETS(Sheet1:Sheet2!A1) = 2
5=SHEETS(Sheet3:Sheet4!A1) = 2
6=SHEETS(Sheet1:Sheet4!A1) = 4
7=SHEETS(Sheet1:Sheet5!A1) = 5

Example 1 - The total number of worksheets in the active workbook is returned.

© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top