Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Simple Relative References in External Links.

Simple Relative References in External Links

by Allen Wyatt
(last updated April 19, 2017)

3

Mike wonders if there is a way to have links to information in an external workbook use relative references. For instance, if there is a link to a cell in another workbook, it is automatically set to an explicit path, such as c:\fullpath\otherfile.xlsx. It would be better for Mike's purposes if it was not an explicit path, instead using simply otherfile.xlsx. That way he could move files around and have the reference be to an external file that is relative to where my current workbook is located.

There is no real way to do this in Excel. The links are created when the linked file is stored. When both workbooks are open (the one with the link and the one that is the target of the link), the links refer to just the filename. The full path location is only saved when the linked file is saved.

If you want to move the location of files, just open both files and then use Save As to save the files where you want them. Excel will update the links to the proper locations. If you move the files around outside of Excel, however, then the links could easily get messed up. (Some people have reported success by having the source and target workbooks always be in the same folder, but this seems to be more simplistic than what Mike is looking for.)

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7923) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Simple Relative References in External Links.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

External Data Validation

When using data validation, you may want to reference a list of validation criteria contained on a different worksheet. ...

Discover More

Pulling Headers and Footers from Other Files

You may have some standard headers and footers you want to make available in your document templates. This tip describes some ...

Discover More

Understanding the Lock Screen

Start up your Windows 8 system, and chances are good that you'll see the Lock Screen almost immediately. Since this is the ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Generating Automatic Links to Audio Files

Need to create links to many filenames on your system? Here are a couple of quick ways to get just the connection you need.

Discover More

Pulling Access Information into Excel

If you have a lot of data stored in Access databases, you may want to get at that information using Excel. There are a few ...

Discover More

Updating Links

When you establish links between data on a target worksheet and data on a source worksheet, those links are typically updated ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 - 1?

2017-04-19 02:49:54

Neil

Actually Excel already effectively does this.

Even though Excel displays the link with the full path name it treats some of these as relative depending upon the circumstances. For example I created a file (Parent.xlsx) with links to Child A.xlsx and Child B.xlsx in their own subfolders. The links show as full pathnames but if I copy the files and folders as a group (say from \Temp to \Temp 2) using file explorer (this is critical) then when I open the Temp 2 versions they link to the subfolders of the Temp 2 folder. NB: You must have the excel files closed when doing this.

If however I open the Parent.xlsx in Excel in the \Temp folder and then save as to the \Temp 2 folder then the links to the Child files will point to the \Temp folder version - effectively destroying the hierarchy. However if you open the linked files and save to the new Temp 2 folders then the hierarchy can be re-established.

Both behaviours can be useful but you need to understand when they should be used. I regularly use both depending upon the circumstances. Try on a few test files to get the hang of it.


2014-09-22 23:04:21

Raj Shivsharan

Thanks.... Viswanath


2013-04-23 13:15:45

Viswanath

Actually it can be achieved:

Using =worksheetname() and =Indirect() function, and naming the worksheets in the parent Excel file with the name of the externally referenced Excel file. Each externally referenced excel file were in their own folders with same name. These sub-folders were only to create more clarity.

--------------------------------------------------------------------------------

What I did was as follows:-

|----Column B---------------|----Column C------------|

R2) Parent folder --------> "C:TEMPExcel"

R3) Sub folder name ---> =worksheetname()

R5) Full path --------------> ="'"&C2&C3&"["&C3&".xlsx]Sheet1'!$A$1"

R7) Indirect function-----> =INDIRECT(C5,TRUE)

In the main file, I had say, 5 worksheets labeled as Ext-1, Ext-2, Ext-3, Ext-4, Ext-5. Copy pasted the above formulas into all the five worksheets. Opened all the respectively named Excel files in the background. For some reason the results were not automatically computing, hence had to force a change by editing any cell. Volla, the value in cell A1 of each externally referenced Excel file were in the Main file.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.