Summary

To get a full path and name for the current workbook, you can use the CELL function and a reference to any cell in the workbook. In the example shown, the formula is:

=CELL("filename",A1)

You must save the worksheet in order to get the a result.

Note: the CELL function is a volatile function and can cause performance problems in larger or more complicated worksheets. 

Generic formula

=CELL("filename",A1)

Explanation 

The CELL function can return various information about a worksheet. CELL can get things like address and filename, as well as information about the formatting used in the cell. The type of information to be returned is specified by the info_type argument. 

In this example, we want the path, name, and sheet for the current workbook. To get this information, the info_type argument is set to "reference" in a formula like this:

=CELL("filename",A1)

With this configuration, CELL will return the name in this format:

C:\examples\[workbook.xlsx]Sheet1

Note that you must save the worksheet in order to get the a result. 

The second argument, reference, is optional and can be any cell in the worksheet. If reference is not supplied, CELL will return the name of the current "active sheet" which may or may not be the sheet where the formula exists, and might even be in a different workbook. To avoid confusion, use A1 for reference.

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.