Put Tab Name in Excel Cell: 3 Easy Ways
In this article
To put a tab name in an Excel cell, use the formula =CELL("filename",A1) and then extract the name with MID and FIND functions, or simply type the tab name manually if you only need it once. The formula method updates automatically when you rename the sheet, while manual entry stays static.
Why You Might Need the Tab Name in a Cell
Excel doesn't have a built-in function that directly returns the current sheet name. However, there are several practical reasons you'd want it displayed in a cell:
- Headers and footers: Show the sheet name in a report title so printed pages are identifiable.
- Summary sheets: When consolidating data from multiple tabs, display each source sheet's name next to its data.
- Dynamic formulas: Use the tab name in formulas like
INDIRECTto reference other sheets without hardcoding names. - Auditing: Quickly see which sheet a value came from when reviewing a workbook.
Method 1: The CELL Function (Dynamic)
The most common approach uses the CELL function with the "filename" info type. This returns the full file path, including the sheet name. To extract just the tab name:
- In any cell, type:
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,31) - Press Enter. The cell now shows the current sheet name.
- If you rename the sheet, the cell updates automatically.
How it works: CELL("filename",A1) returns something like C:\Users\Name\[Workbook.xlsx]Sheet1. The FIND locates the closing bracket ], and MID pulls everything after it. The 31 is just a safety limit—Excel sheet names can't exceed 31 characters.
Important: This formula only works if the workbook has been saved at least once. If you haven't saved it yet, CELL returns an empty string. Also, the file must be saved as an .xlsx or .xlsm—not a .csv, which doesn't support multiple sheets.
Method 2: Manual Entry (Static)
If you only need the tab name once and don't expect to rename the sheet, just type it directly into a cell. For example, if your sheet is named "Sales 2024", type =Sales 2024 in a cell to reference it as text, or simply type Sales 2024 (without quotes) as a string. This is the simplest method but has a big drawback: if you later rename the tab, the cell won't update.
For a static but slightly more automated approach, you can use a macro to write the sheet name into a cell. However, that requires VBA knowledge and isn't necessary for most users.
Method 3: VBA Macro (For Automation)
If you're comfortable with macros, you can write a short VBA routine that inserts the sheet name into a specific cell every time you activate the sheet. Right-click the sheet tab, select View Code, and paste this into the worksheet module:
Private Sub Worksheet_Activate()
Range("A1").Value = Me.Name
End SubThis puts the sheet name in cell A1 whenever you switch to that sheet. It's dynamic and doesn't require formulas. However, you must save the workbook as a macro-enabled file (.xlsm) and enable macros when opening.
How to Choose the Right Method
Consider these factors:
- Dynamic vs. static: If you'll rename tabs, use the CELL formula or VBA. If not, manual is fine.
- Workbook saved?: The CELL formula fails on unsaved workbooks. If you often work before saving, use VBA or manual.
- Macro security: VBA may be blocked in your organization. The formula is safer.
- Complexity: For a one-off, manual typing is fastest.
Common Problems and Fixes
Here are typical issues users encounter:
- Formula returns #VALUE!: This usually means the workbook isn't saved. Save it once and recalculate (F9).
- Formula returns 0 or empty: Check that you're using
CELL("filename",A1)with a reference (A1), not justCELL("filename"). The reference forces Excel to recalculate. - Sheet name has spaces or special characters: The formula handles them fine, but if you use the name in another formula, wrap it in single quotes like
='My Sheet'!A1. - Formula doesn't update after renaming: Press F9 to recalculate, or ensure automatic calculation is on (Formulas tab > Calculation Options).
Alternatives to Displaying Tab Names
If your goal is just to identify the sheet, you don't always need a cell. Excel already shows the sheet name on the tab and in the status bar. For printed reports, you can insert the sheet name into headers or footers: Insert > Header & Footer, then click the "Sheet Name" button (it looks like a small spreadsheet icon). This adds a code like &[Tab] that prints the current sheet name on each page.
Another alternative is to use defined names. You can create a named formula that returns the sheet name, then reference that name in any cell. Go to Formulas > Define Name, enter a name like SheetName, and in "Refers to" enter:
=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,31)Then type =SheetName in any cell to display it. This keeps the formula in one place.
Frequently Asked Questions
Why does my CELL formula return an empty string?
Most likely because the workbook hasn't been saved. The CELL("filename") function only works on saved files. Save the workbook once, and the formula will populate. Also, ensure you're using a reference argument like A1—without it, Excel may not recalculate.
Can I use the tab name in a formula to reference another sheet?
Yes. For example, if cell A1 contains the sheet name (from a formula), you can use =INDIRECT("'"&A1&"'!B5") to pull the value from cell B5 on that sheet. This is useful for summary sheets that pull from multiple tabs.
Does the formula work in Google Sheets?
No, CELL("filename") is not supported in Google Sheets. In Google Sheets, you can use =REGEXEXTRACT(CELL("filename",A1),"(.*)") but it still doesn't work because Google Sheets doesn't return the file path. Instead, use a script or simply type the name.
How do I get the tab name without the file path?
The formula I provided already extracts just the sheet name. If you see the full path, you likely missed the MID and FIND part. Copy the exact formula from Method 1.
Can I make the cell update when I rename the tab?
Yes, the CELL formula updates automatically when you rename the sheet, as long as the workbook is saved and calculation is set to automatic. If it doesn't update, press F9.
Is there a limit to sheet name length?
Yes, Excel limits sheet names to 31 characters. The formula uses 31 as the length argument, so it handles the maximum.