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

Inserting a Document's File Location

Once you save a document on disk, it is stored in a particular folder (or location) on that disk. You may want that location ...

Discover More

Rounding to the Nearest Quarter Hour

When entering times in a worksheet, you may have a need to round whatever you enter to the nearest 15-minute increment. There ...

Discover More

Understanding "Through" Text Wrapping

Understanding how Word handles wrapping text around a graphic or other object is critical to getting the best page layout ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Removing Hyperlinks without a Macro

If you have a whole slew of hyperlinks in a worksheet and you want to get rid of them, it's easier than you think. This ...

Discover More

Unwanted Hyperlinks

Tired of having Excel convert what you type into active hyperlinks? Here are things you can do to undo Excel's conversions or ...

Discover More

Inserting Hyperlinks

Connect your worksheets with other workbooks or with the world of the Internet. The ability to add hyperlinks makes this ...

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 8Mpixels. 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 - 0?

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.