Microsoft KB Archive/323225

= How to display the file name of a worksheet without using a macro in Excel for Mac =

Article ID: 323225

Article Last Modified on 2/1/2007

-

APPLIES TO


 * Microsoft Excel 2004 for Mac
 * Microsoft Excel X for Mac
 * Microsoft Excel 2001 for Mac
 * Microsoft Excel 98 for Macintosh

-



This article was previously published under Q323225



For a Microsoft Excel for Windows version of this article, see 214084.



SUMMARY
This article describes how to create a formula that displays the file name of a worksheet in a cell.

For example, for a file with the path :Users:local:Desktop, the formula returns



where  is the name of your hard disk and   is the name of your saved Excel workbook.



MORE INFORMATION
To display the full path and worksheet name of the current workbook, type the following formula as an array formula

=Cell(&quot;filename&quot;)

where &quot;filename&quot; is literally the word &quot;filename&quot;, in quotation marks.

NOTE: You must input this formula as an array formula. To input a formula as an array formula, press COMMAND+RETURN.

The formula returns the full path and worksheet name of the current workbook as long as the workbook has been saved at least once. If you use this formula in an unsaved workbook, the formula cell remains blank until you save the workbook.

To return the name of the workbook only, use the following formula:

=MID(CELL(&quot;filename&quot;),SEARCH(&quot;[&quot;,CELL(&quot;filename&quot;))+1,SEARCH(&quot;]&quot;,CELL(&quot;filename&quot;))-SEARCH(&quot;[&quot;,CELL(&quot;filename&quot;))-1)

NOTE: You do not have to input this formula as an array formula.

If you use this formula in an unsaved workbook, you receive the following error:


 * 1) VALUE!

When you save the workbook, the file name replaces the error.

Additional query words: macrosheet template howto MacXLX Mac XLX XL2001 XL98

Keywords: kbinfo KB323225

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.