And by filename, you been something like: Book 2.xls
not c:\my documents\excel\book 2.xls
right???
If yes:
=CELL("Filename",A1)
will give you something like:
C:\My Documents\Excel\[book 2.xls]My Sheet Name
So you can use:
=FIND("[",CELL("Filename",A1))
to find the position of the [ character
And
=FIND("]",CELL("Filename",A1))
to find the position of the ] character
And we want the mid portion of that long string starting one character to the
right of [ character for a length of whatever's between the []'s (subtract the
position of the ] from the position of the [ and subtract 1.
Putting it all together in a giant formula:
=MID(CELL("Filename",A1),FIND("[",CELL("Filename",A1))+1,
FIND("]",CELL("Filename")) - FIND("[",CELL("Filename",A1)) - 1)
Remember that the file still needs to be saved at least once for this to work.