Sub topic 6
Using a threshold cell with absolute references
This chapter assumes you can enter formulas, read references such as B2, and copy a formula down a column with the fill handle. It also assumes you can write a basic IF formula with a comparison operator. Here you will move the cutoff value out of the formula and into its own cell. You will then lock that cell with an absolute reference so the formula still works after you copy it.
Why a threshold belongs in a cell
A threshold is the value a test compares against. In the formula =IF(B2>=60,"Pass","Fail"), the threshold is 60. Typing a number directly into a formula is called hardcoding.
Hardcoding causes three problems:
- Hidden rules. Someone reading the sheet sees a bare 60 and has to guess what it means.
- Slow changes. If the pass mark moves to 65, you must edit every formula that contains 60.
- Missed edits. If you update 199 of 200 formulas, the sheet gives wrong results with no warning.
Storing the threshold in one labelled cell fixes all three. You change the number once and every formula follows.
=IF(B2>=$F$1,"Target met","Below target")This formula compares B2 with whatever number is in F1. The dollar signs are what make it safe to copy.
Relative references and what happens when you copy
By default, a cell reference is relative. Excel stores it as an offset from the cell holding the formula, not as a fixed address. If you copy a formula one row down, Excel shifts each relative reference one row down too.
Suppose F1 holds the target of 1000, and you write this in C2 without any dollar signs:
=IF(B2>=F1,"Target met","Below target")Copy it down and the references shift like this:
| Cell | Formula after copying | Threshold it actually reads |
|---|---|---|
| C2 | `=IF(B2>=F1,"Target met","Below target")` | F1 (the target) |
| C3 | `=IF(B3>=F2,"Target met","Below target")` | F2 (empty) |
| C4 | `=IF(B4>=F3,"Target met","Below target")` | F3 (empty) |
B2 becoming B3 is what you want. F1 becoming F2 is not. An empty cell counts as 0 in a numeric comparison, so nearly every row returns "Target met". Nothing shows an error, so the mistake is easy to miss.
Absolute references
An absolute reference never changes when you copy the formula. You make a reference absolute by putting a dollar sign before the column letter, the row number, or both.
$F$1locks the column and the row. This is a fully absolute reference.F$1locks only the row. The column can still shift.$F1locks only the column. The row can still shift.
For a single threshold cell, you almost always want $F$1. The other two forms are called mixed references. They matter when you copy a formula across and down a grid, which this chapter touches on later.
Typing the dollar signs with F4
You do not need to type the dollar signs by hand. While editing a formula, click inside the reference (or put the cursor next to it) and press F4. Each press cycles through the four forms:
F1(relative)$F$1(absolute)F$1(row locked)$F1(column locked)
A fifth press returns to F1. On some laptops you must hold the Fn key as well. On a Mac, the shortcut is usually Command+T, or Fn+F4 depending on your keyboard settings.
Worked example: a sales target
You have a small sales sheet. The target sits in F1, with a label next to it in E1.
| Row | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| 1 | Rep | Sales | Result | Target | 1000 | |
| 2 | Ana | 1250 | ||||
| 3 | Ben | 980 | ||||
| 4 | Chen | 1000 | ||||
| 5 | Dara | 640 |
Follow these steps:
- Click C2 and type
=IF(B2>=$F$1,"Target met","Below target"), then press Enter. - Select C2 again and double-click the fill handle (the small square at the bottom-right corner). Excel fills the formula down to C5.
- Click C3 and look at the formula bar. It reads
=IF(B3>=$F$1,"Target met","Below target").
The results are:
| Rep | Sales | Result |
|---|---|---|
| Ana | 1250 | Target met |
| Ben | 980 | Below target |
| Chen | 1000 | Target met |
| Dara | 640 | Below target |
Chen's 1000 meets the target because the operator is >=, which includes equality. If you wrote >, Chen would show "Below target". Always decide whether the boundary value counts as a pass.
Now change F1 to 900. Ben's result flips to "Target met" immediately, and no formula needs editing. That is the benefit of a threshold cell.
Using the same pattern with calculations
The threshold cell also works when the result is a calculation. Say F1 holds the sales threshold and F2 holds the bonus rate:
=IF(B2>=$F$1,B2*$F$2,0)Both references are absolute because neither the threshold nor the rate should move as you copy down. B2 stays relative because each row has its own sales figure. A good habit is to ask of every reference in a formula: "Should this point to the same cell in every row?" If yes, lock it. If it should follow the row, leave it relative.
Naming the threshold cell
A defined name is an alternative to $F$1. You give the cell a readable label, and the formula uses that label.
- Click F1.
- Click the Name Box (the box left of the formula bar that currently shows F1).
- Type
Targetand press Enter.
You can now write:
=IF(B2>=Target,"Target met","Below target")A defined name is absolute by default, so it does not shift when copied. The formula also reads more clearly. The trade-off is that someone must know where Target points. Names also complicate sheets that are copied between workbooks, because the name may point to the old file. For small sheets, $F$1 is usually enough. Use names when the same threshold appears in many formulas or on several sheets.
Referencing a threshold on another sheet
Thresholds are often kept on a separate sheet named, for example, Settings. The reference then includes the sheet name:
=IF(B2>=Settings!$B$1,"Target met","Below target")The dollar signs still matter. Without them, Settings!B1 would shift to Settings!B2 on the next row, with the same silent failure as before. If a sheet name contains spaces, wrap it in single quotes: 'Sales Settings'!$B$1.
A mixed reference example
Sometimes a threshold differs by group, and you copy one formula across and down. Suppose the thresholds sit in row 1, one per region, and the sales figures are in a grid below:
| Row | A | B | C |
|---|---|---|---|
| 1 | North | South | |
| 2 | Thresholds | 1000 | 800 |
| 3 | Ana | 1250 | 700 |
| 4 | Ben | 980 | 900 |
To flag results in a second block of cells, you could use:
=IF(B3>=B$2,"Met","Below")The row is locked in B$2, so copying down keeps the formula pointing at row 2. The column is free, so copying right moves from B$2 to C$2. This is the kind of case where a mixed reference is better than a fully absolute one. If you used $B$2, the South column would be tested against the North threshold.
Common mistakes with threshold cells
| Symptom | Likely cause | Fix |
|---|---|---|
| Most rows show the "true" result, and rows lower down compare against empty cells | The threshold reference is relative (`F1`) | Change it to `$F$1` with F4 |
| Every row compares against the same number, but it is the wrong number | The reference is absolute but points to the wrong cell | Check the cell address and update it |
| The formula works in C2 but gives odd results after you insert a row above the threshold | The reference moved with the cell, or you pasted over it | Check that `$F$1` still points to the label's neighbour; use a defined name for more safety |
| A boundary value gets the wrong result | Wrong operator (`>` where `>=` was needed) | Decide whether the threshold value itself passes, then pick the operator |
| The formula returns the same result in every row after copying | Calculation set to manual, or the threshold cell holds text such as "1000" stored as text | Press F9 or switch to automatic calculation. Convert text to a number |
The text-number problem deserves a closer look. If F1 contains the text "1000" (often left-aligned, sometimes with a small green triangle), the comparison B2>=$F$1 compares a number with text. Excel treats any text as larger than any number in a comparison, so the test is always false. Re-enter the value, or use Data > Text to Columns on the cell to convert it.
Checking your work
You can confirm that references are locked without reading every formula:
- Click any filled-down cell and read the formula bar. The threshold should still say
$F$1. - Press Ctrl+` (the grave accent key) to show all formulas on the sheet at once. Press it again to hide them.
- Change the threshold to an extreme value, such as 0 or 1000000. Every row should switch to the same result. A row that does not switch is using a different reference.
Exercise
A sheet has scores in B2:B50 and a pass mark of 55 in cell H1. A learner writes =IF(B2>=H1,"Pass","Fail") in C2 and fills it down. Rows near the top look right, but many lower rows show "Pass" for scores of 30. Explain why, and write the corrected formula.
Show answer
The reference H1 is relative, so it shifts to H2, H3, and so on as the formula is copied down. Those cells are empty and count as 0, so almost any score passes. Lock the threshold with an absolute reference: =IF(B2>=$H$1,"Pass","Fail"), then fill down again.
Exercise
Column B holds sales figures, F1 holds a sales target, and F2 holds a bonus rate. Write a formula for C2 that returns the bonus (sales times the rate) when sales reach the target, and 0 otherwise, so that it can be copied down to C100.
Show answer
=IF(B2>=$F$1,B2*$F$2,0). B2 stays relative so it follows each row, while $F$1 and $F$2 are absolute so the target and the rate do not move.
Exercise
Thresholds for three regions are in B1, C1, and D1. Sales for each region are in B2:D20. You want one formula in B2's neighbouring block that can be copied both right and down and always compares a sale with the threshold in row 1 of its own column. Which reference form do you use for the threshold, and why?
Show answer
Use a mixed reference with the row locked, such as B$1. Copying down keeps the formula on row 1, and copying right moves it to C$1 and D$1, so each column uses its own threshold. A fully absolute $B$1 would apply the first region's threshold to every column.