Sei sulla pagina 1di 12

MS EXCELL:

Lesson 16 - Excel Cell References. Relative and Absolute Cell References


EXCEL CELL REFERENCES

More often than not when we create a formula using one of Excels built-in functions we will be referring it
to a cell or range of cells. An example of a single cell reference would be A1. An example of a range of cells
reference would be A1:A10. For the first example we are referring to the content of cell A1 only, while in
the second example we would be referring to the contents of cells A1, A2, A3, A4, A5, A6, A7, A8, A9,
A10. Using the reference A1:A10 is just a simple method that Excel will automatically recognize. If we use
the reference A1:C5 we are telling Excel to refer to the contents of cells A1, A2, A3, A4, A5, B1, B2, B3,
B4, B5, C1, C2, C3 C4, C5. Relative and Absolute Cell References

Relative

In Excel there are two types of cell references, these are Relative and Absolute. We will first look at
relative cell references. All the examples in the Cell References paragraph are what are known as relative
cell references.

As you may remember in lesson 1 we discussed that each cell on an Excel Worksheet has it’s own unique
address, e. g. A1 is the relative address of the first cell on all Worksheets, while IV65536 is the relative
address of the last cell on all Worksheets. The reason why they are called relative is because they are
relative to the cell they are used in. This will be best explained by a simple example.

• In cell A1 type the number 1 and in cell A2 type the number 2.


• Select cells A1:A2 and use the Fill Handle to fill down to A10, so that we have the numbers 1 to 10
in cells A1:A10.
• In cell B1 type this simple reference: =A1 and push Enter. Select cell B1 and do one of the
following
• Copy and then select B2:B10 and paste.
• Double click the Fill Handle.

You should now have the numbers 1 to 10 in both A1:A10 and B1:B10. This because we typed a relative
cell reference in cell B1 (=A1), which is telling Excel to make cell B1 equal the value of the cell one column
to the left on the same row i. e. A1. So when we copy the reference in B1 i. e. =A1 and paste it into cell B2
Excel is still going to reference the cell one column to the left on the same row i. e. A2. Copying the same
cell (B1) and pasting it into cell B3 again tells Excel to reference the cell one column to the left on the same
row i. e. A3.

Lets now copy the content of cell B1 and paste it into cell D1, this time we should get the result 0 (zero). If
you click in cell D1 and look in the Formula bar you will see the relative cell reference: =C1. The reason
we get the result of 0 (zero) is because the value of an empty cell is 0 (zero).

Absolute

Ok, let’s now look at what an Absolute cell reference is. Basically an absolute cell reference is a reference
to a cell that does not change no matter where it is copied. Again this will be easier to see by using an
example.

• Delete the contents of cells B1:B10 and D1.


• In cell B1 type the absolute cell reference =$A$1 and push Enter.
Select cell B1 and either

• Copy and then select B2:B10 and paste.


• Double click the Fill Handle

This time you should have the number 1 in cells B1:B10 and if you select any cell in B1:B10 and look in the
Formula bar, they will all have the absolute cell reference =$A$1. This is because by using the $ (dollar
sign) we are telling Excel to always refer to the same cell no matter where we copy this reference to. The $
in front of the A ($A) is telling Excel to make the column reference absolute, while the $ in front of the 1
($1) is telling Excel to make the row reference absolute. So the reference in its entirety is what is known as
an Absolute cell reference.

If you grasped this concept we can move on to what is known as a either an:

• Absolute row relative column reference or;


• Relative row absolute column reference.

Again the best way to see this is by using a small example.

Relative Row Absolute Column Reference

Try this:

• Delete the contents of cells B1:B10.


• In B1 type the Relative row absolute column reference: =$A1 and push Enter.

Select cell B1 and either.

• Copy and then select B2:B10 and paste.


• Double click the Fill Handle

You will have the numbers 1 to 10 in cells B1:B10. This is because the row portion of the reference (1) is
relative. Now copy cell B10 to cell D1 and you should get the result 1. This is because the column portion of
the reference ($A) is absolute. If you click in any cell in the range B1:B10 or D1 and look in the Formula
bar you will see that the row portion is always relative to the row the reference resides in, while the column
reference is always absolute.

The same principle also applies to any reference that has an absolute row relative column reference. Again
this can be best seen via the use of a small example.

Absolute Row Relative Column Reference

Try this:

• Delete the contents of cells B1:B10 and D1.


• In B1 type the absolute row relative column reference: =A$1 and push Enter.

Select cell B1 and either;

• Copy and then select B2:B10 and paste.


• Double click the Fill Handle.

You will have the number 1 in cells B1:B10. This is because the row portion of the reference ($1) is
absolute. Now copy cell B10 to cell D1 and you should get the result 0, this is because the column portion of
2
the reference (A) is always relative to the column the reference resides in. If you click in any cell in the
range B1:B10 and look in the Formula bar you will see that the row portion is always absolute. If you click
in cell D1 and look in the Formula bar you should see =C$1

See Also: Code to Convert Formula References

Microsoft Excel 2007


Absolute Cell References

An important difference in Excel spreadsheets is between absolute cell references and relative cell
references. To see what this is all about, we'll create a simple spreadsheet. This will illustrate relative cell
references, which is what we've been using so far.

So open up Excel 2007 and enter the same values as in the image below:

In cell B2, you need the following formula:

= A1 + A2

What do you think would happen if we copied an pasted the formula from B2 to cell B3? Let's see:

• Click inside cell B2 to highlight it


• Click on cell B2 with your right mouse button, and select Copy from the menu that appears
• Now click into cell B3
• Again, right click the cell to get the menu. But this time click Paste
• Your spreadsheet should now look like ours:

Cell now says 25! We were trying to work out what 20 + 25 was, and have the wrong answer. So why did
Excel put 25 into cell B3 and not 45?

With cell B3 still highlighted, look at the formula bar at the top of Excel. You should see this formula:

= A2 + A3

3
Click into B2, however, and the formula is this:

= A1 + A2

The problem is due to cell referencing. When you clicked Copy from the menu, Excel didn't only copy the
formula. It took at look at where the cells were in the formula, relative to the B2 cell, and copied this as well.
From B2, the first cell reference (A1) is up one row, and left 1 column (the red arrow below):

The second cell reference (A2) is one column to the left of cell B2:

When you clicked into cell B3 and selected Paste from the menu, Excel was not only pasting the formula, it
was pasting this "up 1, left 1". Take a look at the two images below. We're now starting at cell B3. Have a
look at where the two red arrows are pointing now:

The first cell reference:

The second cell reference:

So the first red arrow is pointing to cell A2, and the second red arrow is point to cell A3. This is what was
copied. Excel then took the formula to mean this:

= A2 + A3

But it should have been this:

= A1 + A2
4
If you want the correct answer in cell B3, you have stop Excel from using this Relative Cell Referencing that
it's currently doing. What you need is Absolute Cell Referencing.

Absolute cell referencing involves nothing more than placing a dollar symbol ( $ ) before each letter and
number.

Click inside of cell B2 on your spreadsheet, and change the formula to this:

= $A$1 + $A$2

Now copy and paste it over to cell B3 again. You should have the correct answer, this time:

Excel will use Absolute Formula in its own calculation, so it's worth getting used to them. But to recap:

• If you need to copy and paste formulas, use Absolute cell references
• Absolute referencing means typing a dollar symbol before the numbers and letters of each cell
reference (You can mix absolute and relative cell references, though).

In the next part, we'll take a look at Named Ranges in Excel 2007

Absolute and Relative Cell References

Computer Tutorials List

Beginners Computing
Microsoft Word
> Microsoft Excel
Web Design
Cascading Style Sheets
Javascript
Visual Basic .NET
Beginners PHP

Excel 2007

Qualifications and
Certificates

5
6
7
Cell Referencing in Microsoft Excel

There are two important spreadsheet concepts we haven't yet explored: absolute cell references, and relative
cell references. We'll explore these two ideas now. First, absolute cell references.

Relative cell references in Microsoft Excel

Take a look at the spreadsheet below (create it for yourself):

As you can see, it's quite simple. All we are doing is adding together the numbers in cells A1 and A2. We
then put the answer in cell B2.

But suppose we wanted to copy the formula in cell B2 to cell B3. Let's try it and see what happens.

• Click inside cell B2


• Then click once with your right mouse button
• A menu pops up
• With your left mouse button, click Copy
• Now click inside cell B3
• Click once with your right mouse button
• When the menu pops up, click on Paste
• Your spreadsheet will look like the one below:

Excel has done something rather odd. It has given us the answer 25! The sum 20 + 25 clearly does not equal
25, so what's going on?

Well, look inside the formula bar. The formula is now reading = A2 + A3. Yet that was not the formula we
pasted from cell B2. We copied and pasted the formula = A1 + A2. So why did Excel copy and paste the
wrong formula?

The answer is that we used a Relative cell reference for B2. We have been using Relative cell references
throughout this book. This is Excel's default, and it works like this when you copy a formula:

The formula is = A1 + A2. The answer is in cell B2. When copying the formula to cell B3 Excel will note
that the cells for the formula start UP one Row, and LEFT one column. When you paste the formula
somewhere else, Excel will not paste the formula, but paste this UP one then Left one. So starting at Cell B3,
which is where we're pasting to, go UP one Row. This takes you to row 2. Then go one column Left. This
8
takes you to Column A. So the start for the new formula is cell A2. Your formula will now read = A2 + A3.
As there is nothing in cell A3, the formula is really = 25 + 0. Which gives the answer 25.

And that's Relative cell referencing.

Absolute cell references in Microsoft Excel

If you want to keep a reference to the original cells, A1 and A2, you need to use Absolute cell references.
Absolute cell referencing is done with dollar signs.

Change your formula in cell B2 to this:

= $A$1 + $A$2

Then copy and paste the new formula to cell B3. You should now get the answer you were looking for: 45.
Your spreadsheet will look like the one below:

To recap, then:

• When you want to copy and paste formulas, use Absolute cell references
• To use Absolute referencing, place a dollar sign before the Column letter and a dollar sign before the
Row number (You can mix absolute and relative cell references, but we won't go into that.)

Using an Excel worksheet - Calculating Percent and Using Absolute Cell Reference

Step 1 - Review percent - Before showing how to calculate percent with Excel, let's review how to calculate
percent.

A number divided by a second number and multiplied by 100 expresses what percent the first number is of
the second number. If you do not multiply by 100 you have the decimal equivalent of percent.

Step 2 - Writing a percent equation for only two numbers- Solve the following: 2 is what percent of 8?

9
Now that you are sure you remember the process for calculating percent, use an Excel worksheet to perform
the calculations.

Step 3. Writing a percent equation for a column of numbers accompanied by a sum. - Data from the ice
cream survey will be used to illustrate how to calculate percentage.

Task: Determine what percent 6 is of 24 by putting the equation into cell C2 of a worksheet similar to the
one above.

Step 4. Auto Fill and problems associated with it - You probably remember a discussion of Auto Fill on a
previous module . That is a convenient way to place information in several cells at the same time. That
might sound like a very good way to fill the equation into cells C3 through C9. For instructive purposes we
will do that now to see the problem it causes.

Oops! Something wrong there. The problem was caused by the way the equation was written. The equation
B2/B10 says, "take the first cell in this equation and divide it by the cell 8 spaces below." The reason that
none of the other equations work is that there is nothing in the cell 8 spaces below any of the cells from B3
to B10. We must find a way of telling Excel to use call B10 to divide by for each of the other 8 equations.

Step 5. Absolute Cell Reference - You tell Excel to use one specific cell, and never move to another relative
location in the calculations by using "absolute cell reference." To specify the cell, place a dollar sign before
the column letter and before the row number. Thus, $B$10 says always use cell B10. Lets go back to the
worksheet and re-write the equation in C2.

10
Notice the answer has not changed. If we were writing only this one equation, we wasted time using
absolute cell reference. The real benefit of this equation will be seen when you fill down into cells C3
through C10.

Step 6. Fill the equation down into the cells below - If you need to review how to accomplish that go back to
a previous module . As soon as you fill this equation with an absolute cell reference down into cells C3
through C10, the percentages are instantly calculated. Only one more task remains.

Step 7. Format the cells - Unless you need five decimal places, I suggest formatting cells C2 through C10,
the highlighted range above, so that one decimal place is displayed.

Right-click on the highlighted range of cells, and select Format Cells... (Macintosh users, Hold down the
Ctrl key while clicking. If you want more information on this see a module about teaching your Mac to
right-click .)

In the category list select Number, and in the Decimal places: box use the down arrow to choose 1.

11
Click OK, your column of data has a nice uniform appearance.

Return to an index of Excel modules

12

Potrebbero piacerti anche