Download the example workbook
This tutorial will demonstrate how to get a sheet name with a formula in Excel.
Get Sheet Name
In Excel there isn’t any one function to get the sheet name directly. But you can get a sheet name using VBA, or you can use the CELL, FIND, and MID functions:
Let’s go through the above formula.
We can use the CELL Function to return the file path, name, and sheet by inputting “filename”.
To get the current worksheet’s name, you can use the function with or without the optional reference argument, referring to any cell on the current tab.
You can also get information about any other worksheet by referring to a cell on that sheet.
As shown above, the CELL Function returns the file path, name, and worksheet. We don’t need the path or workbook name, so we need to isolate the sheet name.
First use the FIND Function to determine the position of the character immediately before the sheet name (which is always “]”).
Since we have the last character position before the worksheet name, we can now use the MID Function to extract the characters after that position. Our sheet name starts at the position found above + 1, but we don’t know how long the sheet name is. However, we do know the maximum length of a worksheet name (31), and we can use that in the MID Function:
Putting this all together yields our original formula: