How to Use IF Function in Google Sheets: Simple Guide
Use the
IF function in Google Sheets to check if a condition is true or false and return different results accordingly. The formula looks like =IF(condition, value_if_true, value_if_false). It helps you automate decisions like showing "Pass" or "Fail" based on scores.Syntax
The IF function has three parts:
- condition: What you want to test (like if a number is greater than 50).
- value_if_true: What to show if the condition is true.
- value_if_false: What to show if the condition is false.
All parts go inside parentheses and separated by commas.
plaintext
=IF(condition, value_if_true, value_if_false)
Example
This example checks if a student's score in cell A2 is 60 or more. If yes, it shows "Pass"; if not, it shows "Fail".
plaintext
=IF(A2>=60, "Pass", "Fail")
Output
If A2=75 โ Pass
If A2=50 โ Fail
Common Pitfalls
Common mistakes include:
- Forgetting to put text results in quotes, like "Pass".
- Using wrong comparison operators (use >=, <=, =, >, <).
- Not closing parentheses properly.
- Mixing up the order of true and false results.
Always double-check your formula syntax.
plaintext
=IF(A2>=60, Pass, Fail) <em>(wrong - missing quotes)</em> =IF(A2>=60, "Pass", "Fail") <em>(correct)</em>
Quick Reference
| Part | Description | Example |
|---|---|---|
| condition | Test to check | A2>=60 |
| value_if_true | Result if true | "Pass" |
| value_if_false | Result if false | "Fail" |
Key Takeaways
The IF function tests a condition and returns one value if true, another if false.
Always put text results inside double quotes in your formula.
Use correct comparison operators like >=, <=, =, >, < for conditions.
Check your parentheses and commas carefully to avoid errors.
IF helps automate decisions like pass/fail or yes/no in your sheets.