How to count the number of sheets of a workbook?
Have you ever considered how to count the number of worksheets in a workbook? To count them one by one is a boring job, if there are lots of worksheets. In fact, there is no straight formula to calculate the number of worksheets. But, here, I can introduce you some useful and handy tricks to deal with this problem.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
In Excel, you can apply a formula into the Define Name feature first, and then count the number of the worksheets.
|Never need to worry about long long formulas in Excel anymore! Kutools for Excel's Auto Text can add all formulas to a group
as auto text, and liberate your brain! Click here to know Auto Text Click here to get free trial
1. Launch your workbook which you want to count the number of worksheets.
2. Click Formula > Define Name, see screenshot:
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:
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:
5. And press Enter key, you will get the number of your worksheets in the current workbook.
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:
If you have Kutools for Excel installed, you can obviously view the number of sheets in a workbook with the Navigation pane.
|Kutools for Excel, with more than 120 handy functions, makes your jobs easier.|
After free installing Kutools for Excel, please do as below:
1. Click Kutools > Navigation to enable the Navigation pane in left of the worksheet. See screenshot:
2. Then click Workbook & Sheets tab, and then you can view the total number of sheets in the active workbook is shown in the bottom of the pane, also you can view the number of visible and hidden sheets of the workbook. See screenshot:
With Navigation pane, you can toogle between sheets, display all column headers, range names, and add auto texts and so on. Click here to know more details.
If you think of above methods are not convenient, I can introduce a round-way for you.
If you have installed Kutools for Excel, you can create a name list of all worksheets, then select them to count in the Status bar.
After free installing Kutools for Excel, please do as below:
1. Enable the workbook you want to count its worksheets, and click Enterprise > Worksheet > Create List of Sheet Names. See screenshot:
2. Then in the popping dialog, check Contains a list of hyperlinks option, and for selecting sheet names conviniently, you can display the sheet index in 3 or 4 columns. See screenshot:
3. Click Ok, then a worksheet is created with all sheets’ names before all sheets, and you just need to select these sheet names, and view the counting result at the Status bar.
Actually, these sheet names are linkable, you can click one sheet name, and then quickly link to the relative sheet. And with Create List of Sheet Names, you can create linkable buttons of sheet names by check Contains buttons and macros option . Click here to know more about Create List of Sheet Names.
|Kutools for Excel: 300 + functions you must have in Excel, 60-day free trial from here|
Navigation pane -- Find and Replace
|Kutools for Excel's advanced Find and Replace function, can help you find and
replace a value across multiple sheets and workbooks.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.
To post as a guest, your comment is unpublished.· 3 years agoI like it. Thanks too much
To post as a guest, your comment is unpublished.· 3 years agoThank you so much for posting these directions!! I have a workbook with over 700 sheets and never knew there was a way for excel to count them for me. I used the first method and it worked absolutely perfectly!!
To post as a guest, your comment is unpublished.· 3 years agoGreat! Saved so much of my time!!
To post as a guest, your comment is unpublished.· 3 years agoHi, Thanks! This worked for me great in excel 2013 to count the number of sheets. Crazy that a formula is required to do this.
To post as a guest, your comment is unpublished.· 4 years agoSorry Freddy. Your first method using Formula > Define Name doesn't work. You got a typo somewhere or something
To post as a guest, your comment is unpublished.· 5 years agoTo count the total of sheets in the same workbook, just go to Formula > Define Name and create a formula like CountSheets = GET.WORKBOOK(4). Type_Num 4 = The number of sheets in the workbook.