Skip to main content

Count the number of sheets in a workbook - a full guide

Author: Xiaoyang Last Modified: 2024-11-22

In Excel, keeping track of the number of sheets in a workbook is essential when managing large datasets or consolidating reports from multiple sources. Whether you're auditing a complex workbook, organizing data, or simply ensuring consistency across your files, knowing how to quickly count the sheets can significantly enhance your productivity. This guide covers several methods to count the number of sheets within a workbook, utilizing built-in Excel functions, the advanced capabilities of Kutools for Excel, defined names, and custom VBA code to suit different user needs and skill levels.

Count the number of sheets


Count the number of sheets in a workbook SHEETS function

If your Excel version is 2013 or later, you can use the SHEETS function to quickly get the total number of the sheets of the current workbook.

Select a blank cell, type the below formula into it and press the Enter key to get the number of sheets.

=SHEETS()

 get the number of sheets with SHEETS function


Easily show the number of sheets in a workbook with Kutools for Excel

If Kutools for Excel is installed, you can easily view the number of worksheets in a workbook in real time using the Kutools Navigation pane.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Enhanced with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

After free installing Kutools for Excel, go to the Kutools tab and select Navigation in the ribbon.

Then, the total number of worksheets in the active workbook is displayed at the bottom of the pane, where you can also see the counts of both visible and hidden sheets.

the  number of worksheets is displayed at the bottom of the pan

Notes:

Count the number of sheets in a workbook with Define Name command

In Excel, you can apply a formula into the Define Name feature first, and then count the number of the worksheets.

1. Launch your workbook which you want to count the number of worksheets.

2. Click Formula > Define Name, see screenshot:

Click Formula > Define Name

3. And in the New Name dialog box, specify a name in the Name text box, and then enter this formula =GET.WORKBOOK(1)&T(NOW()) to the Refers to text box, see screenshot:

specify the options in the dialog box

4. Then click OK to close this dialog, and return to the worksheet, then type this formula =COUNTA(INDEX(CountSheets,0))(CountSheets in this formula is the name you defined in step 3, you can change it as you need.) into a blank cell, see screenshot:

type a formula in a cell

5. And press Enter key, you will get the number of your worksheets in the current workbook.

press enter key to get the result


Count the number of sheets in a workbook with VBA code

If you think the above formulas are somewhat hard to remember, here is a simple VBA code also can help you.

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Count the number of sheets in a workbook

Public Sub CountWorkSheets()
'Update 20140326
MsgBox "The total number sheets of this workbook: " & Application.Sheets.Count
End Sub

3. Then press F5 key to execute this code, and a prompt box will pop out to tell you the total number of the worksheets as following screenshot shown:

run code to get the number of sheets


By applying these methods, you can streamline your workflow, reduce errors, and maintain better control over your spreadsheet environments. Whether you choose a simple function, a tool like Kutools, or delve into VBA scripting, each approach offers valuable solutions to suit your specific operational requirements. For those eager to delve deeper into Excel's capabilities, our website boasts a wealth of tutorials. Discover more Excel tips and tricks here.


Navigation  pane --  List and Count All Sheets

 

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!