The IF function in Google Sheets is a logical function that allows you to make decisions based on a condition. It checks whether a condition is true or false and returns different values accordingly.
This function is widely used for data analysis, reporting, and decision-making.
1. What is the IF Function?
The IF function evaluates a condition and returns one value if the condition is true and another if it is false.
Syntax:=IF(logical_test, value_if_true, value_if_false)
- logical_test — The condition to check (e.g., A1>50)
- value_if_true — The value returned if the condition is true
- value_if_false — The value returned if the condition is false
2. Simple Example
=IF(B2>=50, "Pass", "Fail")
- If the value in B2 is 50 or more, the result will be “Pass”
- If the value is less than 50, the result will be “Fail”
3. Nested IF Function
You can use multiple IF statements to test more than one condition.
Example:=IF(C2>=90, "Excellent", IF(C2>=75, "Good", IF(C2>=50, "Average", "Poor")))
- Checks multiple score ranges and returns a corresponding result
- Useful for grading or categorizing data
4. Common Use Cases
Assign grades based on scores
Categorize sales as “High,” “Medium,” or “Low”
Highlight overdue tasks or status
Create dynamic labels in dashboards
5. Tips for Using IF
Keep logical tests simple to avoid confusion
Use cell references instead of typing numbers directly
Combine IF with other functions like AND, OR, or ISBLANK for advanced logic
Conclusion
The IF function in Google Sheets is a versatile tool for decision-making and data categorization.
By mastering IF and nested IF statements, you can create dynamic spreadsheets that respond automatically to changing data, making analysis and reporting faster and more accurate.