How to Count Number of Worksheets in Excel

Written by

Editorial Team

Reviewed by

Laura Tsitlidze

Last updated on March 20, 2024

This tutorial demonstrates how to count the number of worksheets in an Excel file.


count worksheets 3


Count Number of Worksheets

The easiest way to count the number of worksheets in your workbook is to use the SHEETS Function. Say your Excel file has six worksheets.


count worksheets 1


In any cell on any of the sheets, enter the formula:



count worksheets 2


As you can see, this function without arguments returns the total number of sheets in the current workbook (including hidden sheets).


Count Sheets with VBA

If you want to count the number of sheets using VBA, you can use this Macro:

Public Sub CountMySheets()

MsgBox Application.Sheets.Count

End Sub

AI Formula Generator

Try for Free

See all How-To Articles