Sub topic 2
Copying an IF Formula Down a Column
This chapter assumes you can enter values in cells, reference cells such as B2, and write a basic IF formula with a test, a true result, and a false result. It also assumes you know the comparison operators >=, <=, and =.
Copying a formula down a column
When you copy a formula, Sheets shifts its relative references by the number of rows you move. Suppose C2 contains:
=IF(B2>=50, "Pass", "Fail")Copied to C3, it becomes =IF(B3>=50, "Pass", "Fail"), so each row tests its own score.
To keep a reference fixed, add dollar signs. Put the pass mark in F1 and write $F$1:
=IF(B2>=$F$1, "Pass", "Fail")Every copy now compares against F1. Drag the fill handle in the corner of C2 down the column to fill the rest.
:::callout note Use $ for values that every row should share, such as a threshold. Leave the $ off for references that should change row by row. :::
Checking for blank cells
Empty rows still run the formula, so they show "Fail" unless you guard them. Test column A first:
=IF(A2="", "", IF(B2>=$F$1, "Pass", "Fail"))The empty string "" returns a blank, which keeps unused rows clean.
Testing several conditions with AND, OR, and NOT
AND returns TRUE only when every condition is TRUE. OR returns TRUE when at least one condition is TRUE. NOT reverses a result.
=IF(AND(B2>=50, C2>=50), "Pass", "Fail")
=IF(OR(B2>=50, C2>=50), "Pass", "Fail")
=IF(NOT(A2="Paid"), "Follow up", "Done")| Function | Returns TRUE when | Example |
|---|---|---|
| AND | Every condition is TRUE | Both scores are 50 or more |
| OR | At least one condition is TRUE | Either score is 50 or more |
| NOT | The condition is FALSE | A2 does not equal "Paid" |
:::warning Swapping AND for OR changes the result a lot. Check both conditions in a test row before you copy the formula down. :::
Exercise
Column C should show "Pass" only when both B2 and C2 meet the threshold in F1, and it should stay blank when A2 is empty. Write the formula for C2 that uses an absolute reference and copies down safely.
Show answer
=IF(A2="", "", IF(AND(B2>=$F$1, C2>=$F$1), "Pass", "Fail"))