Excel Formulas for Linking Data between Different Sheets
February 24, 2011 | by techlineinfo.com
When starting to use Excel, we use formulas to manipulate data from other cells in the worksheet. After a while, however, this is no longer enough, as we need to combine data from multiple sheets, or even from other Workbooks.
In this article, we’ll tackle this issue and see how we can access the contents of any worksheet.
Formulas for Linking Data – An Example
Imagine that your supervisor in the fictitious WYZ Widget Company needs you to calculate how much of the assigned budget was actually used (you can find the file here).
Let’s look at the budget sheet (it’s the first in the workbook):
And compare it to the Actual Expenses sheet (the next one in the file):
Well, comparing it by eye just won’t do. We need a new table in which the difference is computed.
We’ll start with an empty table; that is, a table with the same headings for the columns and rows, but no data (available as the third sheet in the file):
In each cell of this table, we want to have the difference between the allocated budget and the actual spending. To do that, we’ll create a formula that deducts the amount of the second sheet (Expenses) from the first sheet (Budget).
To do this , we do the following:
- We select cell B5
- Type in ‘=’ (to start off the formula)
- Click on the Budget sheet tab to display the budget sheet; If you follow these steps you’ll note that the Formula Bar now contains =Budget! – this will be explained in a moment
- We’ll now click cell B5. The Formula Bar should now display =Budget!B5
- Type in – , which will be added to the Formula Bar: =Budget!B5-
- Click on the Actual Expenses sheet’s tab; The sheet’s name will be added to the Formula Bar: =Budget!B5-‘Actual Expenses’!
- Finally we’ll click on the B5 cell of this sheet and press the Enter key; the Difference sheet will be displayed again, and the B5 cell will display a zero amount
Here’s how it should look (check out the formula bar for the formula we created for cell B5):
Exclamation Points to Sheets
OK, what did we do here?
Let’s look at the formula we’ve created and explain the parts.
The first part of the formula we got from the Budget sheet:
When we use a reference to a cell on the current sheet, we just type in the name (or select it using the mouse); when we want to refer to a cell in a different sheet in the same file, we preface it with the name of the sheet and an exclamation mark.
The second part, which we deduct from the first, is:
So, now we have single quotes around the name. Why? Because the name includes a space. Any sheet name that contains a non-alphanumeric character needs to be quoted, so Excel won’t get confused.
Now we can copy this formula to the rest of the cells in the table by using the fill handle.
Grab the fill handle and drag it down to cover the whole column. Excel is smart enough to replace the row numbers in each cell, so we get the difference between the appropriate entries in the two sheets:
You can also select the whole column and go on to fill the whole table by dragging the fill handle to the right up to the December column.
In this article, we learned how to reference data in other sheets, and that Excel’s fill handle is smart enough to work with those references. Will this technique be useful for you? Would you like to learn more about linking data between sheets? How about linking data between workbooks? Please share your thoughts in the comments…
About the Author: Joseph Reese is the founder of Excel-Formulas.com an Excel consulting firm. Head over to his website if you want to improve your performance with Excel.