Sub topic 1
Formulas and cell references: a quick refresher
Prerequisites
This chapter assumes you can enter data in cells, refer to a cell by its address such as B2, and use arithmetic operators such as + and *. Familiarity with IF is not required.
Formulas and cell references
A formula starts with an equals sign. Google Sheets calculates the formula and shows the result in the cell. A cell reference points to another cell's contents. In =B2*2, the reference B2 supplies whatever value sits in that cell, and the formula doubles it.
Comparing values
Comparison operators test how two values relate. Each test returns TRUE or FALSE.
| Operator | Meaning |
|---|---|
| = | equal to |
| <> | not equal to |
| > | greater than |
| < | less than |
| >= | greater than or equal to |
| <= | less than or equal to |
Comparisons with = on text are not case-sensitive. The test "paid"="Paid" returns TRUE.
The IF function
IF takes three arguments: a test, the value to return when the test is TRUE, and the value to return when the test is FALSE.
=IF(B2>=50, "Pass", "Fail")If B2 holds 72, the cell shows Pass. If B2 holds 31, the cell shows Fail.
Returning text, numbers, or nothing
The second and third arguments can be quoted text, plain numbers, or an empty string written as "". An empty string displays a blank cell.
=IF(B2>=50, 1, 0)=IF(A2="", "", IF(B2>=50, "Pass", "Fail"))If you leave out the third argument, the formula returns FALSE when the test fails.
Exercise
What does =IF(B2>=50, "Pass") return when B2 holds 30?
Show answer
FALSE. The third argument is missing, so the formula returns FALSE when the test fails.