Display an Excel Workbook File Name Without the Extension
Question details
Display the current workbook file name in a cell without its path or file extension.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user wants a worksheet formula that shows the saved workbook's name without the extension.
- Observed behavior
- The desired cell displays only the workbook name, even when the name contains periods.
Save the workbook using File > Save or Save As before entering the formula. CELL("filename",A1) may return an empty value until the workbook has been saved.
Use TEXTAFTER and TEXTBEFORE in Microsoft 365
Use this formula in a version of Excel that supports LET, TEXTAFTER, and TEXTBEFORE.
Select File > Save and give the workbook a file name if prompted.
Select the cell where you want the name to appear and enter =LET(f,CELL("filename",A1),n,TEXTBEFORE(TEXTAFTER(f,"["),"]"),TEXTBEFORE(n,".",-1)).
Press Enter. The cell should show the workbook name without its path or final extension.

Use helper-cell formulas in older Excel versions
Use this approach if TEXTBEFORE, TEXTAFTER, or LET is unavailable.
Display the Workbook Name in WPS Spreadsheets
Use CELL and text formulas in WPS Spreadsheets to extract a saved workbook's name and remove its extension.
- 1. Open the workbook: Open WPS Spreadsheets and select File > Open to choose your workbook.
- 2. Save the file: Select File > Save or Save As and give the workbook a file name.
- 3. Extract the file name: In an empty cell such as B1, enter =MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1).
- 4. Remove the extension: In another cell, enter =LEFT(B1,FIND(CHAR(1),SUBSTITUTE(B1,".",CHAR(1),LEN(B1)-LEN(SUBSTITUTE(B1,".",""))))-1) and press Enter.

Frequently Asked Questions
Why is CELL("filename") blank?
The workbook may not have been saved. Select File > Save, then recalculate the formula. If needed, close and reopen the saved workbook.
Will the formula work if the workbook name contains periods?
Yes. The Microsoft 365 formula removes the text after the last period in the extracted file name. The older-version helper-cell formula also removes the final extension.
What if Excel does not recognize TEXTBEFORE or TEXTAFTER?
Your Excel version may not support those functions. Use the helper-cell formulas with MID, FIND, LEFT, and SUBSTITUTE instead.
Can I display the file name with its extension?
Yes. Use the first helper-cell formula to extract the text between the square brackets returned by CELL("filename",A1).




