Sub topic 5
Copying an IF Formula Down a Column
Assume you know how to enter data in cells, use references such as A1 and B2, and write basic formulas with operators such as + and *. In this chapter, you will copy one IF formula down a column so each row evaluates its own data.
Start with a row-level formula
Suppose a sheet has this structure:
| A | B | C |
|---|---|---|
| Student | Score | Result |
| Ana | 72 | |
| Ben | 45 | |
| Chen | 88 |
You want column C to show Pass when the score is at least 50 and Fail otherwise. In C2, enter:
=IF(B2>=50, "Pass", "Fail")The formula has three parts:
B2>=50is the test."Pass"is returned when the test is TRUE."Fail"is returned when the test is FALSE.
When C2 evaluates the formula, it checks B2. The formula should check B3 for Ben and B4 for Chen. You can make that happen by copying C2 down.
Use the fill handle
To copy the formula:
- Select C2.
- Point to the small square at the lower-right corner of the cell. This is the fill handle.
- Drag the fill handle down to C4.
Google Sheets adjusts the row reference in each copied formula:
| Cell | Formula after copying | Result |
|---|---|---|
| C2 | `=IF(B2>=50, "Pass", "Fail")` | Pass |
| C3 | `=IF(B3>=50, "Pass", "Fail")` | Fail |
| C4 | `=IF(B4>=50, "Pass", "Fail")` | Pass |
This automatic adjustment is called a relative reference. B2 is relative because both its column and row can change when the formula moves.
You can also copy a formula with keyboard shortcuts. Select C2, press Ctrl+C on Windows or ChromeOS, select C3:C4, and press Ctrl+V. On macOS, use Command+C and Command+V.
Keep a threshold fixed
Sometimes the pass mark is stored in a separate cell. For example, enter 50 in F1. Then use this formula in C2:
=IF(B2>=$F$1, "Pass", "Fail")Here, B2 remains relative, so it becomes B3 and B4 when copied. $F$1 is an absolute reference. The dollar signs lock both the column F and row 1, so every copied formula continues to use the threshold in F1.
Without the dollar signs, a formula copied from C2 to C3 would use F2. If F2 is empty or contains another value, the results may be wrong.
Verify copied formulas
After filling a column, select a few result cells and read the formula bar. Check that:
- The score reference changes by row, such as B2, B3, and B4.
- The fixed threshold remains
$F$1. - Text results have quotation marks.
- The formula was not replaced by a manually typed result.
A useful test is to change one score. If B3 changes from 45 to 60, C3 should change from Fail to Pass. This confirms that the formula still refers to B3.
Common copying mistakes
If every row shows the same result, inspect the references. You may have typed a fixed value instead of a cell reference, or used an absolute reference for the score, such as $B$2.
If the threshold changes unexpectedly, check whether you wrote F1 instead of $F$1.
If a formula displays as text, make sure it begins with = and that the cell is not formatted as plain text. Re-entering the formula often fixes this.
Exercise
In C2, write a formula that returns "Ready" when B2 is at least the value in F1 and "Review" otherwise. The formula will be copied down.
Show answer
=IF(B2>=$F$1, "Ready", "Review")