The IF function in Google Sheets is one of the most versatile and commonly used functions. It’s incredibly useful for making decisions within your data, allowing you to return different values based on whether a condition is true or false. Whether you’re working with financial data, analyzing survey results, or building dynamic reports, mastering the IF function can save you time and add power to your spreadsheets.
What is the IF Function in Google Sheets ?
The IF function is a logical function that checks whether a condition is true or false. It then returns one value if the condition is true and another value if it is false. The basic
=IF(logical_ test, value_ if_ true, value _if_ false)
- logical_ test: This is the condition you want to check.
- value_ if_ true: The value to return if the condition is true.
- value_ if_ false: The value to return if the condition is false.
Basic Example of the IF Function
Let’s start with a simple example:
Assume you have a column with students’ scores and you want to mark them as “Pass” or “Fail” based on whether their score is above 50. Here’s how you’d use the IF function: IF Function in Google Sheets
=IF(A2 > 50, "Pass", "Fail")

In this example:
- A2 > 50: The condition checks if the value in cell A2 is greater than 50.
- “Pass”: If the condition is true (the score is greater than 50), the function returns “Pass.”
- “Fail”: If the condition is false (the score is 50 or below), the function returns “Fail.”
Using Nested IF Functions
Sometimes, you need more than just two options. In this case, you can use nested IF functions. Let’s say you want to categorize scores into three groups: “Excellent,” “Good,” and “Needs Improvement.” Here’s how to do that:
=IF(A2 > 80, "Excellent", IF(A2 > 50, "Good", "Needs Improvement"))
In this case:
- If the score is greater than 80, it returns “Excellent.”
- If the score is between 51 and 80, it returns “Good.”
- If the score is 50 or below, it returns “Needs Improvement.”
Real-Life Examples of Using the IF Function
The IF function is not just for educational or simple use cases. It can be applied to a variety of real-life situations, making it a versatile tool in your spreadsheet arsenal.
-
Calculating Discounts Based on Purchase Amounts
Imagine you’re managing a sales team and you want to apply a discount based on the amount of a customer’s purchase. If a customer spends over $500, they get a 10% discount; otherwise, no discount is applied. You can use the IF function to calculate this.
=IF(B2 > 500, B2 * 0.10, 0)
In this case:
- B2 > 500: The condition checks if the purchase amount in cell B2 is greater than $500.
- B2 * 0.10: If true, it calculates a 10% discount on the purchase.
- 0: If false, it returns 0, meaning no discount.
-
Evaluating Employee Performance
Say you’re tracking employee performance and you want to assign ratings based on their performance score. If their score is above 80, they get an “A”; if it’s between 60 and 80, they get a “B”; otherwise, they get a “C.”
=IF(C2 > 80, "A", IF(C2 > 60, "B", "C"))
In this case:
- If the score in cell C2 is above 80, the employee receives an “A.”
- If the score is between 61 and 80, the employee receives a “B.”
- If the score is 60 or below, the employee receives a “C.”
-
Financial Forecasting and Budgeting
For budgeting purposes, you can use the IF function to check if expenses are within budget. Let’s say you have a budget of $1,000, and you want to check whether the actual spending (in cell D2) exceeds the budget.
=IF(D2 > 1000, "Over Budget", "Within Budget")
- If the spending in D2 exceeds $1,000, the result will be “Over Budget.”
- If the spending is within the budget, it will say “Within Budget.”
-
Checking for Missing Data
If you have a dataset where some cells may be empty, you can use the IF function to check for missing data and return a helpful message, such as “Missing Data.”
=IF(A2 = "", "Missing Data", "Data Present")
This checks if cell A2 is empty:
- If A2 is empty, it returns “Missing Data.”
- If there is any data in A2, it returns “Data Present.”
Using IF Function with Other Functions
The IF function can also be combined with other functions to perform more complex tasks. For example, you can use IF with AND or OR to check multiple conditions.
Example with AND
Let’s say you want to check if both the “sales” and “expenses” in two cells meet specific conditions. You could use the AND function with IF to return “Profit” if both conditions are true:
=IF(AND(B2 > 500, C2 < 300), "Profit", "Loss")
- AND(B2 > 500, C2 < 300): This checks if sales (in B2) are greater than $500 AND expenses (in C2) are less than $300.
- If both conditions are true, it returns “Profit.” If not, it returns “Loss.”
Example with OR
If you want to check if either one of two conditions is true (for example, either sales exceed $500 or expenses are less than $300), you can use the OR function inside the IF Function in Google Sheets :
=IF(OR(B2 > 500, C2 < 300), "Profit", "Loss")
- OR(B2 > 500, C2 < 300): This checks if either sales (in B2) are greater than $500 OR expenses (in C2) are less than $300.
- If either condition is true, it returns “Profit.” If neither condition is true, it returns “Loss.”
Conclusion
Mastering the IF function in Google Sheets opens up countless possibilities for data analysis, decision-making, and reporting. Whether you’re working on financial models, performance evaluations, or any other kind of dataset, the IF function is an essential tool in your spreadsheet toolkit. By using real-life examples like calculating discounts, evaluating performance, or checking for missing data, you can see how powerful this function is when combined with other logic functions. IF Function in Google Sheets
Now that you understand how the IF function works, you can begin using it in your own projects to make your Google Sheets even smarter and more efficient. Happy spreadsheeting! IF Function in Google Sheets
Visit our YouTube channel to learn step-by-step video tutorials
Youtube.com/@NeotechNavigators