

There are many cases, in which you want to show the sheet name or file name in an Excel cell. Don’t worry, you don’t have to use VBA and create a macro. Excel provides a (rough) formula for returning all the information you need. The bad news: In most cases it takes some complex modifications. The good news: Usually you can just copy and paste the formula you need.
Contents
Fortunately, you don’t have to use VBA. There are formulas for each variation of the sheet name, file name and path. The main part of the formula is the =CELL() formula.
The CELL formula looks something like this: =CELL(“filename”,A1). That means that the CELL formula we have to use has two parts:
The basic version of the CELL formula (=CELL(“filename”,A1) ) returns the full path, file name and sheet name. You can use this formula and cut it into the parts you need. Therefore you use string formulas like LEFT, LEN and so on. We won’t go into detail now as those formulas are highly specific and complex but rather provide the formulas for you to copy.
Note: We’ve published an article about three methods of how to get the sheet name. Maybe this one is interesting for you as well.
The formulas for inserting file names, sheet names or the path (with and without the extension) are very different. This table gives you an overview. If you want to copy the formulas, you can find them underneath again.
Overview: All the formulas for getting a file name, sheet name or path in Excel
If you want to get the file name, sheet name or path from another cell or workbook, you can use one of the following formulas. Instead of “A1” you insert your cell reference.
Please note:
Download the formulas within this Excel file so that it adapts to your language and regional settings automatically
In order to avoid any problems with language and regional settings, you can download all the above formulas with an Excel file.
Just open it and copy the complete cell to your desired location. The download starts instantly (no sign-up or any other annoyances…).
Anything missing? Suggestions for improvements? Please let us know and leave a comment.
'Professor Excel Tools': Add more than 60 amazing features to Excel!
Professor's Error Helper for Excel: Solve any error in Excel.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
Comments 4
doug
formulas to obtain file update, creation date information
Bob Fleming
I get my filename and path by inserting
=cell(“filename”) and it put it right where I want it (next to bottom row in spreadsheet so it shows when I print) . However, as I am working with several spreadsheets, the filename changes to the last spreadsheet worked with, so I constantly need to re-insert the correct filename. Very frustrating.
Any solutions to stop my filename from changing. It should always reflect the corret filename for the spreadsheet I am working on, once I have inserted after the first time.
Kindest,
Bob
Ben Moy
Move the formula down 1 line; then, copy and ‘paste values’ in the original cell before you print.
Khoder Seif
I’ve made a reference in one cell to another one which is in another file (this file is located in another place).
the Problem is ( sometimes it refer it as in harddisk H:, othertimes as //EVA/EAR) so it couldn’t make the update of the data (and it doesn’t complain that he didn’t find the path)
Vlookup(TV$2;’\Eva\EAR\Daten\……….
Vlookup(TV$2;’H:\Daten…….