Get Filename in MS Excel
How to get filename in excel
We may need to get the sheetname or the filename of the current excel worksheet into a cell. It is fairly simple to get it.
Use the following formula
This will give the full file name. Check out the various options of the same given below.
Get Filename full
Get Full file name with location path
In any cell use the following formula
This will give the full file name along with the path.
For example :- F:\TECHIE 5\EXCEL\[Get_Filename.xls]Sheet1
In the above example “Get_Filename.xls” is the file name and “Sheet1” is the sheet name.
Get only the sheet name
But if we would like to have only the sheet_name? Then what to do?
Well then we improvise!!
We modify the earlier formula to get the sheetname out of it as follows.
If we check out the above formula we see that we have searched for “]” and then extracted the sheet_name which comes immediately after that.
Many other options can be found out from excel help.
We Have shown two examples of getting the filename or sheetname.
Using the same approach we can get whatever we want out of the basic =CELL(“filename”,A1) formula.
An example excel is attached at the end of the article with the above two examples