Sub topic 6
Checking for blank cells
Prerequisites
You should already know how to enter data in Google Sheets, use cell references such as A2, and write basic formulas. You should also understand that a formula begins with =.
A blank check tests whether a cell has no useful value. This lets you leave unused rows empty instead of showing misleading results such as Fail, 0, or Follow up.
Use an empty-string comparison
The most common blank check is:
=A2=""This comparison returns TRUE when A2 is empty. It also returns TRUE when a formula in A2 returns an empty string, written as "".
Put the comparison inside IF when you want different results for blank and nonblank cells:
=IF(A2="", "Missing name", "Name entered")If A2 is blank, the result is Missing name. Otherwise, the result is Name entered.
A common pattern is to return an empty string for an unused row:
=IF(A2="", "", IF(B2>=50, "Pass", "Fail"))This formula works in a result column:
- If there is no name in
A2, it displays nothing. - If there is a name and
B2is at least 50, it displaysPass. - If there is a name and
B2is below 50, it displaysFail.
The first "" is a result that looks blank. The second "" is also the result for the false branch of the outer IF? No. In this formula, the outer IF returns the first "" when A2 is blank. When A2 is not blank, it evaluates the inner IF.
Understand `ISBLANK`
Google Sheets also provides the ISBLANK function:
=IF(ISBLANK(A2), "", "Ready")ISBLANK(A2) returns TRUE only when the cell is genuinely empty. It returns FALSE if the cell contains a formula, even when that formula displays nothing with "".
Use A2="" when you want to treat both empty cells and formula-generated empty strings as blank. Use ISBLANK(A2) when the distinction matters.
| Cell content in A2 | `A2=""` | `ISBLANK(A2)` |
|---|---|---|
| Truly empty cell | TRUE | TRUE |
| Formula returning `""` | TRUE | FALSE |
| Text such as `Ready` | FALSE | FALSE |
Handle spaces and missing values
A cell containing one or more spaces is not empty. Therefore, this formula treats a space as entered data:
=IF(A2="", "Missing", "Entered")If users may enter spaces accidentally, remove surrounding spaces before checking:
=IF(TRIM(A2)="", "Missing", "Entered")TRIM removes extra spaces at the beginning and end of text. It also helps when data was pasted from another source.
Keep the blank check before calculations that should apply only to completed rows. For example:
=IF(A2="", "", IFERROR(B2/C2, "Check data"))This formula leaves rows without a name blank. For named rows, it returns the division result or Check data when the calculation produces an error, such as division by zero.
Common mistakes
- Use two double quotes,
"", for an empty text result. A single quote does not create an empty string. - Put text results in quotation marks, such as
"Missing". - Count the parentheses. Each
IF(needs a matching). - Decide whether a formula returning
""should count as blank before choosingA2=""orISBLANK(A2). - Check the intended input column. A formula that tests
A2but reads the score fromB2should be copied with matching row references.
Exercise
Write a formula that returns "" when A2 is blank, Pass when B2 is at least 50, and Fail otherwise.
Show answer
=IF(A2="", "", IF(B2>=50, "Pass", "Fail"))