|  

» Cell Function Returns Sheet Name, Workbook Name and Path

The Cell function returns information about the formatting, location, or contents of the upper-left cell in a reference.

To get the sheet name:
=MID(CELL("filename"),FIND("]",CELL("filename"))+1,255)

To get the workbook name:
=MID(CELL("filename"),FIND("[",CELL("filename"))+1,(FIND("]",CELL("filename"))+1)-FIND("[",CELL("filename"))-2)

To get the path address & workbook name:
=CELL("filename")

To get the path address:
=MID(CELL("filename"),1,FIND("[",CELL("filename"))-1)
Screenshot // Cell Function Returns Sheet Name, Workbook Name and Path
Cell Function Returns Sheet Name, Workbook Name and Path

Rate This Tip
12 34 5
Rating: 3.72     Views: 207845
missing parenthesis
immyjimmy  Posted on: 31-12-1969
The formula listed here: =MID(CELL("filename"),1,FIND("[",CELL("filename"))+1, FIND("]",(CELL("filename"))-FIND("[",CELL("filename"))-1) seems to be missing a closing parenthesis.
Workbook Name function
Buzz  Posted on: 31-12-1969
The following function works correctly to return the workbook name:
=MID(CELL("filename"),FIND("[",CELL("filename"))+1,(FIND("]",CELL("filename"))+1)-FIND("[",CELL("filename"))-2)
Workbook Sheet name
DAn  Posted on: 31-12-1969
the function =MID(CELL("filename"),FIND("]",CELL("filename"))+1,255) seems to be a global function. Putting multiple instaces of this function on separte sheets, always returns the same name
Workbook Name Function
lkb  Posted on: 31-12-1969
I can't get this formula to work, but this formula has 8 functions in the argument, I thought you could only have 7 functions in the formula.
The fuction returns same value everywhere
Prabs81  Posted on: 31-12-1969
The functions listed here return same value if these are used in more than one worksheet or workbook...
proper worksheet name on each sheet
HB  Posted on: 31-12-1969
the function =MID(CELL("filename"),FIND("]",CELL("filename"))+1,255) returns the same value on each sheet unless you add a cell reference after "filename".

the formula should look like this when done:
=MID(CELL("filename",b1),FIND("]",CELL("filename",b1))+1,255)

By adding a cell reference after filename, the value returned should be the worksheet name of the proper worksheet and not the same value for all worksheets.
Error in "Worksheet function that returns the workbook name"
Louie Hui  Posted on: 31-12-1969
Hello:

Thank you for your information, I found it very useful. There is small error in this formula. "Worksheet function that returns the workbook name:"

The corrected one should read as follow

=MID(CELL("filename"),FIND("[",CELL("filename"))+1,FIND("]",CELL("filename"))-FIND("[",CELL("filename"))-1)
Name
Comment Title
Comments