Inserting location in Excel enables you to find a specific file when you want to use it. It is easier to trace and access your Excel file once you have inserted a location in it. You do not have to enter the location manually. It is easy to insert a location in Excel. Despite the ease of the process, it is not all that intuitive of a process as you have to know how to go about it.
In the article below, we discuss the different methods you can use to insert location in an Excel file. Here we go.
How to insert a full path
In this method, we insert the document’s full path using the toolbar location, where you can copy it when needed. Below are the steps to be followed to insert the location in an Excel file:
1. In an open Excel workbook, click on the File tab on the main menu ribbon.
2. Click on Options to display a dialog box from the given list of options on the left pane.
3. In the displayed Excel Options dialog box, here is what you will do:
4. Click on the Quick Access option on the left pane list.
5. Under the title Choose Commands from, click on the drop-down arrow and select All Commands from the drop-down list.
6. Next, choose Document Location and click the Add>>
7. Click OK. You will see that the current file’s full path shows on the right in your Excel workbook.
8. Lastly, you can copy the file path and paste wherever you need it
9. You will also realize the Document Location command is added in Excel’s Quick Access Toolbar.
Inserting the current Excel File Location in a cell with a formula
Excel formulas always come in handy when dealing with data in Excel. The formula also becomes useful as you can use one to insert location in an Excel file. You can get the current Excel file location in a cell directly by entering the formula below:
=LEFT(CELL("filename"),FIND("[",CELL("filename"),1)-1)
In this formula, we use the FIND and LEFT functions to track down the location of an Excel file. The CELL function will return the file path, sheet, and name, and that’s why it is used together with the text functions.
Inserting location in Excel’s Header or Footer
1. Open your Microsoft Excel program and open the worksheet to which you wish to insert the location.
2. Click on the File tab and click on the Page Setup option to display a dialog box.
3. Here, click on the Custom Header or Custom Footer buttons to display a dialog box.
4. You can position your Insertion point in the Left, Center, or Right section.
5. Click on the File button for Excel to automatically insert a code at the insertion point.
6. Click the OK button twice, as prompted by Excel, to close all dialog boxes.
Using VBA code to insert Excel File Path in Excel
You can use VBA code to insert an Excel file path in a cell. VBA, also known as Macro, allows users to develop their own functions for efficiency. Follow these simple steps.
1. Click on the Developer Tab, then select VBA or use the shortcut Alt+f11 on Windows or FN+OPT+F11 on Mac. This will open up the VBA editor
2. Click on Insert, then select module
3. Copy and paste the code below into the editor.
Sub DisplayFileLocationInCell() Dim FilePath As String ' Get the file path of the currently open workbook FilePath = ThisWorkbook.FullName ' Display the file path in the first cell (A1) of the active sheet ActiveSheet.Cells(1, 1).Value = "The file location is: " & FilePath End Sub
4. Press F5 to run the code or Click on the small green icon.
Download practice worksheet
Insert location practice worksheet
Read more