Function Problems

Get an Excel Workbook File Name Without Its Extension

Emma BrownEmma Brown Nov 18, 2026 869 views

Question details

Extract the current workbook’s file name without its extension using an Excel formula.

Get an Excel Workbook File Name Without Its Extension
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user wants to display the saved workbook’s name in a worksheet without its path or file extension.
Observed behavior
The desired result is the workbook name alone, even when the name contains additional periods.
Before you start

Save the workbook first, because CELL("filename") needs a saved file to return its path and name. Choose two empty cells for the workbook name and the final result.

Solution 1Recommended

Extract the Workbook Name and Remove Its Extension

Use two formulas to extract the name and remove the final extension, including when the name contains periods.

1
Save the workbook

Select File > Save or press Ctrl+S, and give the workbook a file name if prompted.

2
Extract the 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). This returns the workbook name with its extension.

3
Remove the extension

In another empty cell, enter =LEFT(B1,FIND(CHAR(1),SUBSTITUTE(B1,".",CHAR(1),LEN(B1)-LEN(SUBSTITUTE(B1,".",""))))-1). Replace B1 with the cell containing the extracted name if necessary.

Extract the Workbook Name and Remove Its Extension
Names with multiple periods: The second formula removes the final period and everything after it, preserving earlier periods in the workbook name.
Try WPS Spreadsheet

Extract a Workbook Name in WPS Spreadsheet

Use CELL and text formulas in WPS Spreadsheet to display a saved workbook’s name without its extension.

  1. 1. Open the workbook: Open your spreadsheet in WPS Spreadsheet and select File > Save to ensure it has a saved file name.
  2. 2. Extract the full name: Select an empty cell such as B1 and enter =MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1).
  3. 3. Remove the extension: In another empty cell, enter =LEFT(B1,FIND(CHAR(1),SUBSTITUTE(B1,".",CHAR(1),LEN(B1)-LEN(SUBSTITUTE(B1,".",""))))-1).
  4. 4. Save the result: Select File > Save to keep the formulas in the workbook.
Extract the workbook name without its final extensionPreserve periods that are part of the workbook nameOpen and edit Microsoft Excel XLSX filesWork with familiar spreadsheet formulas
microsoft office alternative - wps office

Frequently Asked Questions

Why does CELL("filename") return an empty value?

The workbook must be saved before CELL can return its path and file name. Select File > Save, then recalculate the worksheet if needed.

Does the MID formula remove the file extension?

No. It extracts the text between the workbook brackets, which includes the extension. Use the second formula or TEXTBEFORE to remove it.

What if the workbook name contains more than one period?

Use =TEXTBEFORE(B1,".",-1) in a supported Microsoft 365 version, or use the LEFT and SUBSTITUTE formula above. Both remove only the final extension.

Why does Excel show #NAME? for TEXTBEFORE?

Your Excel version may not support TEXTBEFORE. Use the LEFT and SUBSTITUTE formula in the recommended solution instead.