30 Advanced Excel Tips for 2026

Excel Champs / Excel Formulas List / How to Get Sheet Name in Excel (Formula)
By Puneet Gogia (Microsoft MVP)

How to Get Sheet Name in Excel (Formula)

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

To return the current sheet’s name, use =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255). CELL("filename") gives the full path with the sheet name after the closing square bracket, and MID pulls everything from that point on.

In Excel 365 it’s much shorter: =TEXTAFTER(CELL("filename",A1),"]"). The reference argument matters — without it, CELL("filename") returns whichever sheet was last calculated, not the sheet the formula sits on, so a workbook with several sheets shows the wrong name.

The file must also be saved at least once, or CELL returns an empty string. A VBA alternative is Function mySheetName() returning ActiveSheet.Name, but add Application.Volatile or it won’t refresh when you rename the tab.

[thrive_lead_lock id=’73767′]

In Excel, there is no direct function to get the sheet name of the active sheet. Now the solution to this problem is to create a formula using multiple functions or to use a custom function created using the VBA.

In this tutorial, you will learn both methods with examples.

Use a Formula to Get the Worksheet Name

To create a formula to get the worksheet name we need to use CELLS, FIND, and MID function. Following is the function where you can get the sheet name.

=MID(CELL("filename"),FIND("]",CELL("filename"))+1,LEN(CELL("filename")))

You enter the above formula in any of the cells in the worksheet for which you want to have the sheet name. Now let’s understand this formula, and to understand this we need to break it up into four parts.

In the first part, we have a CELL function that returns the address of the workbook along with the current sheet’s name.

formula-to-get-worksheet-name

And, following is the address that we got from the cell function. Here you can see you have the sheet name at the end of the address, and you need to get the sheet name from it.

worksheet-address

Now in the second part, we have the FIND function that uses the cell function to get the address and find the position of the character that you have exactly one position ahead of the sheet name.

find-function

And once you get the position number of “]”, you need to add 1 into it to get the position of the first character of the sheet name.

add-1-to-get-the-position

Now in the third part, you have the LEN and CELL functions to count of the characters in the entire path.

len-and-cell-function

Now at this point, we have the address path, the position of the first character of the sheet name, and the count characters that we have in the address path.

worksheet-address-path

And in the fourth part, by using the MID function you have got the sheet name in the result.

[thrive_leads id=’112075′]

Create a User-Defined Function to Get Sheet Name

Getting a sheet name by a UDF is the easiest way. You don’t need to create a complex formula, but a simple code like the following.

user-defined-function-to-get-sheet-name
Function mySheetName()
mySheetName = ActiveSheet.Name
End Function

Now let’s learn how we can use this code to extract the current worksheet’s name in a cell. Use the following steps:

  1. First, go to the Developer tab and click on Visual Basic.
    developer-tab
  2. Now in the Visual Basic Editor, go to the Insert option and click on the Module to Insert a Module.
    module-to-insert-module
  3. After that, go to the code window and paste the above code there.
    code-window
  4. In the end, close the visual basic editor and come back to the worksheet.

Now, select any of the cells in the worksheet for which you want to get the name and enter the following function there.

select-any-cell-to-get-the-name

You can learn more about creating a custom function from this tutorial.

Get the Excel File

Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel

Leave a Comment