How to return filename without extension in Excel?
Working with filenames in Excel can sometimes be challenging, especially when you want to display only the filename—excluding its file extension—for cleaner reports or to meet specific formatting requirements. For instance, when importing lists of files, managing logs, or reporting data, you may need to separate the filename from its extension. In this tutorial, you'll find a comprehensive guide to several practical methods for extracting and returning filenames without their extensions in Excel, ranging from formulas to VBA, Power Query, and smart Kutools options. Each method can serve different scenarios based on your dataset size, frequency of updates, and automation needs.
Return filename without extension with formulas
Return filename without extension with Kutools AI Aide
Easily get workbook information (sheet name, file name/path, etc.) with Kutools for Excel
Return filename without extension from a list with VBA Code
Return filename without extension with Power Query
More tutorials for getting workbook information...
Return filename without extension with formulas
Excel makes it possible to extract the filename without its extension using formula combinations.
1. Select a blank cell where you want to display the extracted filename.
2. Enter or copy the below formula into the selected cell and press Enter to see the result.
=MID(CELL("filename",A1),SEARCH("[",CELL("filename",A1))+1,SEARCH(".",CELL("filename",A1))-1-SEARCH("[",CELL("filename",A1))) 
Notes:
- 1. You can use the alternative formula below, depending on your preference for text functions or the Excel version:
=TRIM(LEFT(SUBSTITUTE(MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,255),".xl",REPT(" ",255)),255)) - 2. In all formulas, A1 is a variable, you can change it to any other cell reference.
Return filename without extension from a list with Kutools AI Aide
If you need an efficient solution without manual formula entry, Kutools for Excel provides an AI-powered utility. This method is suitable for users who want to simplify complex tasks or need to handle dynamic filenames regularly. Kutools AI Aide interprets your instructions and automates the process of extracting the filename.
After installing Kutools For Excel, initiate the "Kutools" > "AI Aide" pane.
- Click to select the cell where you want the output to appear.
- Type your instruction in the chat box, such as:
Return this workbook name without extension in selected cell. - Press Enter or click "Send" to prompt the AI to analyze the command. Once ready, click "Execute" to produce the result.
This method is suitable for users who do not want to memorize formulas or want results with minimal effort. It also handles other workbook-related extraction tasks. If you face issues, ensure your input is clear and follow the AI’s guidance closely.
Easily get workbook information (sheet name, file name/path, etc.) with an amazing tool
For those frequently needing workbook, sheet, or file path details—apart from just the filename—Kutools for Excel features a utility named "Insert Workbook Information." This option is particularly useful for formal reports or documentation requiring repeated insertion of file data.
1. Select the cell where you'd like the information to be placed, then click "Kutools Plus" > "Workbook" > "Insert Workbook Information". See screenshot:

2. In the dialog box, select the desired workbook detail from the "Information" section, choose its placement under "Insert at," and click OK.
As shown below, the filename will be inserted into cell A2 after confirmation.

You may need to further process the inserted filename if it includes the extension. You can use the formula described above to remove the extension from this result.
Kutools for Excel - Supercharge Excel with over 300 essential tools, making your work faster and easier, and take advantage of AI features for smarter data processing and productivity. Get It Now
Return filename without extension with VBA Code
For users who prefer a more automated or advanced approach, you can use VBA (Visual Basic for Applications) to extract and return the filename without its extension. This is especially practical when processing large datasets or when filenames are being updated dynamically, as VBA enables batch processing and is highly customizable.
1. Click Developer Tools > Visual Basic. In the pop-up Microsoft Visual Basic for Applications window, click Insert > Module, and then paste the following code into the new Module:
Sub ExtractFilenameNoExtension()
Dim WorkRng As Range
Dim cell As Range
Dim fileName As String
Dim dotPos As Integer
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Select the range of filenames", xTitleId, WorkRng.Address, Type:=8)
For Each cell In WorkRng
fileName = cell.Value
dotPos = InStrRev(fileName, ".")
If dotPos > 0 Then
cell.Offset(0, 1).Value = Left(fileName, dotPos - 1)
Else
cell.Offset(0, 1).Value = fileName
End If
Next
End Sub 2. Click the
button to execute the code. When prompted, select the range containing your filenames, e.g., A1:A10. The result (filename without extension) will appear in the adjacent column B.
This solution is suitable for batch processing, and especially useful if filenames are updated regularly or imported from other sources. If you get errors, make sure your data does not have empty cells or non-text entries mixed in.
Tips:
- You can change
cell.Offset(0,1)to another offset if you want results placed in a different column.
Return filename without extension from a list with Power Query
Excel Power Query offers a robust solution for extracting filenames without extensions, suitable for users managing lists of files or importing data from folders. This method is ideal for larger datasets, recurring imports, or when working with external data sources such as lists of files from a folder or database.
1. Select your filename list (or path list) and go to Data > From Table/Range to load your data into Power Query.
2. In Power Query Editor, select the column containing your filenames. Then, go to Add Column > Custom Column.
3. Enter a custom formula to remove the extension. In the dialogue, use this formula (replace [Filename] with your column name if different):
Text.BeforeDelimiter([Filename], ".") 4. Click OK to apply the transformation. The new column will display only the filename without the extension.
5. Click Close & Load to return the processed data to your Excel worksheet.
In Power Query, you can also use more advanced logic to handle filenames with multiple dots, or if you need to trim directory paths as well. Be careful to select the correct column and check for any blank or invalid entries. Power Query processes updates dynamically, making it a good choice for ongoing data connections and imports.
Each of these methods has its own advantages depending on your workflow. Simple formulas work great for small, static lists. Kutools options provide intuitive automation for daily routine needs. VBA does well in batch automation tasks. Power Query is best suited for advanced data processing, integration, and regular imports. Be sure to select the method that suits both the scale and complexity of your project.
Related articles
Get and insert the last modified user name in Excel
This article will show you the way to get the last modified user name information, and insert the last modified user name information in cells in Excel.
Insert filename in header/footer/cell without extension in Excel
Normally an open workbook’s filename and extension are displaying at the top of Excel window. If you need to insert only filename without the extension at the header, footer, or a cell. How to solve it? This article will introduce methods to get it done.
Insert last saved timestamp into worksheet cell in Excel
In many cases, you may need to show the last saved date and time of an Excel workbook in order to know when the file was updated recently. Try methods in this article.
Insert page number into cell / header / footer in Excel
When you print an Excel file, you may need to insert the page numbers into the pages to make the printed file neatly and readably. This tutorial introduces some quick tricks to insert the page numbers into cell, header or footer for you.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
All Kutools add-ins. One installer
Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.
- All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
- One installer, one license — set up in minutes (MSI-ready)
- Works better together — streamlined productivity across Office apps
- 30-day full-featured trial — no registration, no credit card
- Best value — save vs buying individual add-in