# How to use relative references - example 1

Now that we've looked at the basics of relative references in formulas, let's look at a common use case for relative references—calculating a total price from a unit price and quantity across a number of line items.

Let's take a look.

In this worksheet, we have a list of materials to build a dog house in column B, and the cost of each item in column D. We also have the quantity needed for each item in column C.

Let's create a formula that calculates the total cost for each item, taking into account the quantity. This is a perfect application for relative cell references.

To start off, we'll create our first formula in cell E6. We want to multiply the quantity times the unit cost, so our formula is = C6 * D6.

Note that C6 and D6 are relative references which is Excel's default behavior.

For our first item, we get a total of $25.00 since 2 x 12.50 = 25. If we change the quantity, we see the total recalculate as expected.

To fill in the rest of the formulas, we could just enter each formula manually. But that's a lot of busy work and it isn't necessary. Instead, let's take advantage of relative references and just copy and paste the formula down the rows. Control-C to copy; Control-V to paste.

If we check the copied formulas, we see that they have been updated as needed. Each formula still refers to column C and D as before, but the row numbers were automatically updated when the formulas were pasted.

Note that we could have used the Fill handle to copy the formulas as well. If we undo the paste using Control-Z, we can drag the Fill handle to copy the formulas. Or, we could just double-click the Fill handle. Either way, the result is the same.

## Related shortcuts

## Download 200+ Excel Shortcuts

Get over 200 Excel shortcuts for Windows and Mac in one handy PDF.