Sub topic 5
Worked example: one tax rate cell for a whole price list
This chapter assumes you can enter values and formulas in Google Sheets, read addresses such as A1 and B2, and use basic arithmetic operators. It also assumes you know that a relative reference changes when you copy a formula. Here you will use an absolute reference to build a price list that depends on one tax rate cell.
The problem: a rate that many formulas share
A price list often needs the same number in every row. A tax rate is the usual case. If you type 0.2 inside every formula, you must edit every formula when the rate changes. That is slow, and it is easy to miss a row.
The better design is to store the rate once in an input cell. Every formula then points at that cell. When the rate changes, you edit one cell and all results update.
The difficulty is copying. Copying a formula shifts its relative references. The reference to the price should shift, because each row has its own price. The reference to the rate must not shift, because there is only one rate. This chapter shows how to get both behaviors from one formula.
Set up the sheet
Build this layout in a blank sheet.
| Cell | Content |
|---|---|
| A1 | Price |
| B1 | Tax |
| C1 | Total |
| A2 | 10 |
| A3 | 25 |
| A4 | 40 |
| A5 | 99.99 |
| E1 | 0.2 |
| D1 | Tax rate |
Column A holds the prices. Cell E1 holds the tax rate, 0.2, which means 20%. The label "Tax rate" sits in D1 so a reader knows what E1 means. Columns B and C will hold the tax amount and the total price.
Keep the rate cell outside the table of prices. If you place it inside column A or B, filling or sorting the list can overwrite it or move it.
Step 1: write the formula with a relative rate
Start with the version that looks natural. In B2, enter the tax amount for the first price.
Cell B2: =A2*E1For row 2 this gives 10 × 0.2 = 2, which is correct. The problem appears when you copy it. Drag the fill handle (the small square at the bottom right corner of the selected cell) from B2 down to B5.
Cell B2: =A2*E1
Cell B3 (after fill down): =A3*E2
Cell B4 (after fill down): =A4*E3
Cell B5 (after fill down): =A5*E4Both references moved down one row for each row you filled. The price reference moved as intended. The rate reference moved too, so B3 now multiplies by E2, which is empty. An empty cell counts as 0 in arithmetic, so B3 shows 0. The same happens in B4 and B5.
Here is the sequence of events.
Notice that B2 looks right. The error only shows up in the copied cells, so always check at least one copied row after filling.
Step 2: lock the rate with $
An absolute reference adds a dollar sign before the column letter and before the row number. The dollar sign tells Sheets to keep that part fixed when the formula is copied.
Rewrite B2 with the rate locked.
Cell E1: 0.2 (tax rate)
Cell B2: =A2*$E$1
Cell B3 (after fill down): =A3*$E$1Read $E$1 as "column E, row 1, both fixed". The first dollar sign locks the column and the second locks the row. Now fill B2 down to B5.
| Cell | Formula after fill | Result |
|---|---|---|
| B2 | =A2*$E$1 | 2 |
| B3 | =A3*$E$1 | 5 |
| B4 | =A4*$E$1 | 8 |
| B5 | =A5*$E$1 | 19.998 |
Each row now uses its own price and the single shared rate. The reference A2 is still relative, so it moves with the row. The reference $E$1 is absolute, so it does not.
You choose which references to lock one at a time. A single formula can contain both kinds, and that is the normal case.
Step 3: add the total column
The total is the price plus the tax. In C2 enter:
Cell C2: =A2+B2This uses only relative references, which is what you want. Fill it down to C5. Each total adds the price and tax from its own row.
You could also compute the total directly from the price and the rate, without a tax column.
Cell C2: =A2*(1+$E$1)Both approaches give the same result. The version with a separate tax column is easier to audit because you can see each amount. The single formula is shorter. Pick based on whether readers need to see the tax on its own.
Step 4: change the rate and watch the sheet update
Change E1 from 0.2 to 0.25. Every tax and total value changes at once, with no further editing. This is the main benefit of the design: one fact lives in one place.
You can test that the lock works by comparing a result with a hand calculation. With a rate of 0.25 and a price of 40, B4 should show 10. If it shows 0 or an unexpected number, a dollar sign is missing or misplaced.
Three ways to copy the formula
The reference behavior is the same whichever method you use. The methods differ only in how you trigger the copy.
- Fill handle. Select B2, then drag the small square at the bottom right corner down to B5.
- Double-click autofill. Select B2 and double-click the fill handle. Sheets fills down as far as the adjacent column A has data. This stops at the first blank cell in column A, so a gap in your prices leaves the fill short.
- Copy and paste. Select B2, press Ctrl+C (Cmd+C on a Mac), select B3:B5, and press Ctrl+V. Sheets adjusts relative references by the distance between the source and the destination.
Whichever method you use, $E$1 stays as it is and A2 shifts.
Typing the dollar signs
You can type the dollar signs yourself. A faster way is to type the reference as E1, then press F4 while the cursor is in or next to that reference. Pressing F4 cycles through E1, $E$1, E$1, and $E1. Stop when you see $E$1. On some laptops you may need to hold the Fn key as well. A later chapter covers this toggle in more detail.
Edge cases
Inserting rows or columns
If you insert a row above row 1, the rate cell moves to E2, and Sheets rewrites $E$1 to $E$2 in every formula. Absolute references follow the cell they point at when the sheet structure changes. They only stay fixed when the formula is copied. These are two separate behaviors, and mixing them up is a common source of confusion.
Moving a formula with cut and paste
Cut and paste moves a formula without changing its references. It behaves differently from copy and paste. If you cut B2 and paste it in G2, the formula still reads =A2*$E$1. Use copy and paste when you want references to adjust.
Deleting the rate cell
If you delete the cell E1, or delete its row or column, formulas that point at it show #REF!. This tells you the reference no longer has a target. Restore the cell with undo, or write the rate into a new cell and update the formulas.
Formatting the rate as a percentage
You can type 20% into E1 instead of 0.2. Sheets stores it as 0.2 and shows it with a percent sign. The formulas work the same way. Typing 20 without a percent sign gives a rate of 2000%, so the results will be 100 times too large. Check the display format if your numbers look far too big.
Text in the rate cell
If E1 contains text such as "20%" typed as a text string (for example after pasting from another source), the multiplication returns #VALUE!. Retype the number or change the cell format to a number or percent.
Checking your work
Use a short checklist after you fill a formula.
- Click each filled cell and read its formula in the formula bar.
- Confirm the price reference changes row by row.
- Confirm the rate reference is identical in every row.
- Compare one result with a hand calculation.
- Change the rate once and confirm every row updates.
The checklist takes under a minute and catches most reference errors before they spread.
Summary of the pattern
The pattern in this chapter applies well beyond tax. Whenever many formulas need the same input, put the input in one cell, give it a visible label, and refer to it with a fully absolute reference. Leave the references to row-specific data relative. Then fill the formula over the whole range.
Exercise
A sheet has prices in A2:A6 and a discount rate of 0.15 in cell G1. You enter =A2*G1 in B2 and fill down to B6. B3 shows 0. Write the corrected formula for B2, state what B4 will contain after filling, and explain why B3 showed 0.
Show answer
The corrected formula for B2 is =A2$G$1. After filling down, B4 contains =A4$G$1. B3 showed 0 because the relative reference G1 shifted to G2 in row 3, and G2 is empty, so the formula multiplied A3 by 0.
Exercise
With the setup from this chapter, you want the total price in C2 as a single formula that does not use column B. Write it so that it fills correctly down to C5 and uses the rate in E1. What happens to the results if you insert a new row above row 1?
Show answer
Use =A2(1+$E$1) in C2 and fill down. If you insert a new row above row 1, the rate moves to E2, and Sheets updates the formulas to =A3(1+$E$2) and so on, because absolute references follow the cell they point at when rows are inserted. The results stay the same.