Sub topic 12
Common mistakes and how to fix them
This chapter assumes that you can enter data in Google Sheets and understand cell references such as A2 and B2. You should also know basic arithmetic operators such as + and *, and the basic structure of an IF formula.
An IF formula has three parts:
=IF(test, value_if_true, value_if_false)For example:
=IF(B2>=50, "Pass", "Fail")The formula tests B2>=50. If the test is true, it returns "Pass". Otherwise, it returns "Fail".
Read the error message first
An error message usually identifies the type of mistake. These are common messages:
| Error or result | Likely cause | Fix |
|---|---|---|
| `#ERROR!` | Invalid formula syntax | Check commas, quotes, and parentheses |
| `#VALUE!` | The formula received an unexpected type of value | Check whether a cell contains text instead of a number |
| `#DIV/0!` | A formula divided by zero or a blank cell | Check the divisor or use `IFERROR` |
| `FALSE` | The false result was omitted | Add the third argument if needed |
| A blank result | The formula returns `""`, or the source cell is blank | Inspect the formula and source data |
A syntax error means Sheets cannot parse the formula. It often comes from a missing comma, quote, or closing parenthesis.
Missing quotes around text
Text returned by a formula must be inside quotation marks. This formula is correct:
=IF(A2="Paid", "Done", "Follow up")This formula is incorrect because Paid, Done, and Follow up are treated as names or references:
=IF(A2=Paid, Done, Follow up)Use quotation marks for text values. Do not use quotation marks around cell references or numbers:
=IF(B2>=50, "Pass", "Fail")Google Sheets compares text with = without distinguishing uppercase and lowercase letters. Therefore, "paid" also matches "Paid".
Mismatched parentheses
Every opening parenthesis needs a closing parenthesis. Nested formulas are especially easy to miscount:
=IF(B2>=90, "A", IF(B2>=80, "B", IF(B2>=70, "C", "F")))This formula contains three IF calls, so it needs three closing parentheses at the end. Enter the formula gradually if you are unsure. First create the inner IF, test it, and then add the outer conditions.
Incorrect comparison operators
Choose the operator that matches the rule:
=means equal to.<>means not equal to.>means greater than.<means less than.>=means greater than or equal to.<=means less than or equal to.
For example, a score of exactly 50 should pass this test:
=IF(B2>=50, "Pass", "Fail")Using >50 would incorrectly mark 50 as "Fail".
Do not confuse the comparison operator with assignment. In a Google Sheets formula, = starts the formula and also compares values inside the formula.
Missing or wrong cell references
When copying a formula down a column, B2 changes to B3, B4, and so on. This is a relative reference. If a threshold is stored in F1, lock it with dollar signs:
=IF(B2>=$F$1, "Pass", "Fail")Without $F$1, the threshold changes as the formula moves down. Check both the row and column before filling a formula.
Blank rows and unexpected results
A comparison with an empty cell can produce a result that does not match your intention. Add a blank check first:
=IF(A2="", "", IF(B2>=50, "Pass", "Fail"))This formula returns an empty string when the name in A2 is blank. Otherwise, it evaluates the score.
Errors inside an IF formula
IF does not automatically hide errors in its test. Wrap the formula in IFERROR when an invalid input should receive a clear message:
=IFERROR(IF(B2/C2>0.5, "High", "Low"), "Check data")If C2 is zero, the division would produce #DIV/0!. IFERROR returns "Check data" instead.
Conditions that never get tested
With nested IF or IFS, Sheets uses the first true condition. Put stricter or higher thresholds first:
=IFS(B2>=90, "A", B2>=80, "B", B2>=70, "C", TRUE, "F")If B2>=70 appears first, a score of 95 receives "C" and never reaches the test for "A". Include TRUE as the final condition when you need a default result.
Exercise
A formula is =IF(B2>50, Pass, Fail). What is wrong, and how should it be written?
Show answer
The text values need quotation marks. Write =IF(B2>50, "Pass", "Fail").