Working with Links in Formulas
If you have data in one workbook that you want to use in another, you can set up a link between them. This action enables your formulas to use references to cells or ranges in the other workbook. Excel updates the link automatically when the other data changes.
For example, Figure 3.11 shows two linked workbooks. The Budget Summary sheet in the 2011 Budget—Summary workbook includes data from the Details worksheet in the 2011 Budget workbook. Specifically, the formula shown for cell B2 in 2011 Budget—Summary contains an external reference to cell R7 in the Details worksheet of 2011 Budget. If the value in R7 changes, Excel immediately updates the 2011 Budget—Summary workbook.
Figure 3.11 These two workbooks are linked because the formula in Cell B2 of the 2011 Budget—Summary workbook references Cell R7 in the 2011 Budget workbook.
Understanding External References
There's no big mystery behind these external reference links. You set up links by including an external reference to a cell or range in another workbook or in another worksheet from the same workbook. As shown in the example in Figure 3.11, enter an equal sign in cell B2 of the Budget Summary worksheet, and then click cell R7 in the Details worksheet.
However, you need to be comfortable with the structure of an external reference. Here's the syntax:
'path[workbookname]sheetname'!reference
path |
The drive and directory in which the workbook is located, which can be a local path, network path, or even an Internet address. You need to include the path only when the workbook is closed. |
workbookname |
The name of the workbook including an extension. Always enclose the workbook name in square brackets ([ ]). You can omit workbookname if you're referencing a cell or range in another sheet of the same workbook. |
sheetname |
The name of the worksheet's tab. You can omit sheetname if reference is a defined name in the same workbook. |
reference |
A cell or range reference or a defined name. |
For example, if you close the 2011 Budget workbook, Excel automatically changes the external reference shown in Figure 3.11 to the following, depending on the actual path of the file:
='C:\Users\Paul\Documents\[2011 Budget.xlsx]Details'!$R$7
Updating Links
The purpose of a link is to avoid duplicating formulas and data in multiple worksheets. If one workbook contains the information you need, you can use a link to reference the data without recreating it in another workbook.
However, to be useful, the data in the dependent workbook should always reflect what actually is in the source workbook. You can make sure of this by updating the link as follows:
- If both the source and the dependent workbooks are open, Excel automatically updates the link whenever the data in the source file changes.
- If the source workbook is open when you open the dependent workbook, Excel automatically updates the links again.
- If the source workbook is closed when you open the dependent workbook, Excel displays a Security Warning in the message bar, which tells you that automatic updating of links has been disabled. In this case, click Options, click the Enable this Content option, and then click OK.
- If you did not update a link when you opened the dependent document, you can update it any time by choosing Data, Edit Links. In the Edit Links dialog box that appears (see Figure 3.12), click the link and then click Update Values.
Figure 3.12 Use the Edit Links dialog box to update the linked data in the source workbook.
Changing the Link Source
If the name of the source document changes, you'll need to edit the link to keep the data up-to-date. You can edit the external reference directly or you can change the source by following these steps:
- With the dependent workbook active, select Data, Edit Links to display the Edit Links dialog box.
- Click the link you want to work with.
- Click Change Source. Excel displays the Change Source dialog box.
- Find and then select the new source document, and then click OK to return to the Edit Links dialog box.
- Click Close to return to the workbook.