What Is IF Function In Google Sheets?
IF Function in Google sheets is a logical function used to find the results logically. It is a default function and is commonly used in Excel as well as Google sheets. For example, consider the below table showing marks obtained by students in an exam.

Now, let us learn how to find the students who have passed and failed in the exam.
To start with, click on the cell where we have to find the result. In this example, it is cell B2. Now, insert the formula with the arguments “PASS” and “FAIL”. So, the formula is =IF(B2>40,”PASS”,”FAIL”). Press Enter key. We can see the result as shown in the below image.

Using Autofill option, we can find the result in other cells. Likewise, we can use IF function to find the result using logical conditions.
In this article, let us learn how to use IF function in Google sheets with detailed examples.
Table of Contents
Key Takeaways
- IF function in Google sheets function helps users find the logical result according to the user’s requirements.
- The formula of IF function in Google sheets is =IF(logical_expression,value_if_true,value_if_false) where the first two arguments, logical expression and value if true are mandatory.
- We can use a combination of OR and AND functions in IF function in Google sheets.
- The formula of OR function in Google sheets is =OR(logical_expression1,[logical_expresion2]…) where the logical expressions shows the logical value we need to check.
- The formula of AND function in Google sheets is =AND(logical_expression1,[logical_expresion2]…) where the logical expressions denotes the logical value we need to check.
Syntax
The formula is
=IF(logical_expression,value_if_true,value_if_false)
Where the first two arguments, logical expression and value if true are mandatory.
- logical expression: It is a mandatory argument that shows the cell range to be tested using the IF function.
- value if true: This is also a mandatory argument and the function returns the logical value true if the data satisfies the given condition.
- value if false: This is not a mandatory argument and the function returns the logical value false if the data does not satisfy the given condition.
How To Use IF Function In Google Sheets?
Let us use the IF condition to understand how it works in Google sheets with the below example.
Consider the below table showing products and units available in a company.

Now, let us learn how to find the number of available and out of stock products in the given data in Google sheets.
The steps are:
Step 1: To start with, click on the cell where we have to find the result. In this example, it is cell B2.
Step 2: Now, insert the IF Function formula in Google sheets.

Next, insert the formula with the arguments “PASS” and “FAIL”.

So, the formula is =IF(B2>1,”Available”,”Out of Stock”)
Step 3: Press Enter key.
We can see the result as shown in the below image.

Using Autofill option, we can find the result in other cells as shown in the below image.

Likewise, we can use the IF function in Google sheets to find the result using logical conditions.
Now, let us use the below examples to understand how IF function works with other conditions and functions.
Examples
Let us have a look at the following examples.
Example #1 – IF Function With Multiple Conditions
Consider the below table showing marks obtained by students in semester 1 exams in various subjects.

Now, we need to find if students scored pass or fail or distinction in semester 1 exams.
The steps are:
Step 1: Select the cell where we want to find the result. In this example, it is cell C2.
Step 2: Now, insert the formula, =IF(B2>=35,”Pass”,IF(B2>=95,”DIST”,IF(B2<35,”Fail”)))

Step 3: Press Enter key.
We can see the result in cell C2.

Using AutoFill option, we can obtain results in cell range C3:C6.

Likewise, we can use multiple conditions in IF function in Google sheets.
Example #2 – IF Blanks/ Non-Blanks
Let us use the same example we used before.
Consider the below table showing marks obtained by students in semester 2 exams in various subjects.

Now, we can see some blank spaces in the data in column B. We need to find the result of showing Present in non-blank cells and Absent in blank cells.
During situations like these, we need to use IF function with Blanks and Non – Blank in Google sheets.
The steps are:
Step 1: Select the cell where we want to find the result. In this example, it is cell C2.
Step 2: Now, insert the formula, =IF(B2=””,”Absent”,”Present”)

Step 3: Press Enter key.
We can see the result in cell C2.

Using AutoFill option, we can obtain results in cell range C3:C6.

Likewise, we can use IF function with blanks and non blanks in Google sheets.
Example #3 – IF In Combination With OR Function
Consider the below table showing products along with the units sold in the particular region in columns A, B, and C.

Now, we need to find whether the targets are achieved or not. Assume that in North or South regions, the company has to sell 10 units. If this is sold, it means that the target is achieved and if not, it has to mentioned as not achieved.
During situations like these, we need to use IF function with OR function in Google sheets.
The syntax of OR Function is
=OR(logical_expression1,[logical_expresion2]…)
Where the logical expressions shows the logical value we need to check.
Now, let us use the IF function along with OR function in Google sheets.
The steps are:
Step 1: Select the cell where we want to find the result. In this example, it is cell D2.
Step 2: Now, insert the formula, IF function along with OR function. The, insert the arguments.
So, the complete formula is as shown in the below image.

Step 3: Press Enter key.
We can see the result in cell D2.

Using AutoFill option, we can obtain results in cell range D2:D4.

Likewise, we can use IF function with OR function in Google sheets.
Example #4 – IF In Combination With AND Function
Let us use the same example we used in IF and OR functions in Google sheets.
Consider the below table showing products along with the units sold in the particular region in columns A, B, and C.

Now, we need to find whether the targets are achieved or not. Assume that in North and South regions, the company has to sell 10 units. If this is sold, it means that the target is achieved and if not, it has to mentioned as not achieved.
During situations like these, we need to use IF & AND function in Google sheets.
AND Function in Google sheets syntax is
=AND(logical_expression1,[logical_expresion2]…)
Where the logical expressions show the logical value we need to check.
Now, let us use the IF with AND functions in Google sheets.
The steps are:
Step 1: Select the cell where we want to find the result. In this example, it is cell D2.
Step 2: Now, insert the formula, IF function along with AND function. The, insert the arguments.
So, the complete formula is as shown in the below image.

Step 3: Press Enter key.
We can see the result in cell D2.

Using AutoFill option, we can obtain results in cell range D2:D4.

Likewise, we can use IF & AND function in Google sheets.
Nested IF Function In Google Sheets
Consider the below table showing marks obtained by students in semester 1 exams in various subjects.

Now, we need to find if students scored pass or fail or distinction in semester 1 exams.
The steps are:
Step 1: Select the cell where we want to find the result. In this example, it is cell C2.
Step 2: Now, insert the formula as shown in the below image.

Step 3: Press Enter key.
We can see the result in cell C2.

Using AutoFill option, we can obtain results in cell range C3:C6.

Likewise, we can use Nested IF function in Google sheets.
Important Things To Note
- IF Google sheets function is used to find the result logically.
- We need to use logical operators such as greater than, lesser than, greater than or equal to, lesser than or equal to, equal to, not equal to in the IF function.
- It is a default function in Google sheets.
Frequently Asked Questions
For example, consider the below table showing marks obtained by students in an exam.
Now, let us use IF function to find the students who have passed and failed in the exam.
The steps are:
Step 1: To start with, click on the cell where we have to find the result. In this example, it is cell B2.
Step 2: Now, insert the IF Function formula with the arguments “PASS” and “FAIL”. So, the formula is =
Step 3: Press Enter key.
We can see the result as shown in the below image.
Likewise, we can use the IF function to find the result using logical conditions.
IF Function in Google sheets and Excel is a logical function which helps users find the result logically. It is a default function and is commonly used with logical operators.
In Google sheets, we can combine IF function with OR, AND, COUNT and other functions to find the desired result as required by the users.
Download Template
This article must help understand the IF Function In Google Sheets and examples. We can download the template here to use it instantly.
Recommended Articles
Guide to What is IF Function In Google Sheets. Here we discuss how to use IF Function In Google Sheets with its Nested IF Function and examples. You can learn more from the following articles. –
Leave a Reply