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

Searching for Tabs

Tabs don't normally show up in your printed document, but Word allows you to still search for them. All you need to do is use ...

Discover More

Editing the Custom Spelling Dictionaries

When spell-checking a worksheet, Excel relies on both built-in and custom dictionaries. Here's how to edit the content of ...

Discover More

Positioning a Graphic in a Macro

Macros are a great way to process information in a worksheet. Part of that processing may involve moving graphics around so ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Easily Changing Links

If you have linked information in your worksheets, you may want a way you can easily change the targets to which those links ...

Discover More

Removing Hyperlinks without a Macro, Take Two

Need to get rid of hyperlinks in a worksheet? Here's an easy way to do it without using a macro.

Discover More

Jumping to a Specific Cell Using a Hyperlink

Excel allows you to define hyperlinks in your worksheets, and these can target specific cells on other worksheets. Here are ...

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. 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 three more than 8?

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.