How to Get the Current Sheet Name

2017-08-13

Example

Generic Formula

=RIGHT(CELL(“filename”),LEN(CELL(“filename”))-FIND(“]”,CELL(“filename”)))

filename – This is a system defined input for the CELL function.

What It Does

This formula will return the sheet name of the current sheet.

How It Works

CELL(“filename”) will return the full file path of the current workbook (let’s call this the FilePath) which includes the folder path, workbook name and the current sheet name. In our example FilePath is C:\Users\John\[How to Get the Current Sheet Name.xlsx]My Sheet.

FIND(“]”,FilePath) will return the location of the “]” character before the sheet name (let’s call this the Location). In our example FIND(“]”,FilePath) returns the value 132 since “]” is the 132nd character in the FilePath text string.

LEN(FilePath) will return the total character length of the FilePath text string (let’s call this the TotalLength). In our example LEN(FilePath) returns the value 140 since there are 140 characters in the text string.

We can now get the length of the sheet name by subtracting TotalLength-Location. In our example the sheet name length is 140-132=8 characters.

RIGHT(FilePath,TotalLength-Location) will then return the right most 8 characters of the FilePath, which gives us the sheet name. In our example this is My Sheet.

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and freelance consultant and trainer specializing in Excel, Power BI, Power Automate, Power Apps and SharePoint. You can find other interesting articles from John on his blog or YouTube channel.

Subscribe

Related Articles

Comments

0 Comments

Get The Latest News

Follow Us

Follow us on social media to stay up to date with the latest tips in Excel!

Pin It on Pinterest