Google Sheets incorporates various features that make working much easier for us, such as the SUMIF, IFNA, and IF CONTAINS functions. The Google Sheets IF THEN formula is one of those fantastic features. The IF formula in Google Sheets can be used to check a condition and then return a specified value if it is TRUE or return a different specified value if FALSE.
You can take marking exam scores as an example. When a person wants to simplify the task of marking whether a student passed or not, they can use the if then formula Google Sheets provides to return “Pass” if the score is greater than the set value. Otherwise, “Fail.”
In other words, if you want to run a logical test in a Google Sheets formula that returns different results depending on whether the test is TRUE or FALSE, you must use the Google Sheets IF else formula. You can use various formulas to get the function to work how you need it to. In this article, we will be discussing how to put it to use in Google Sheets. Read on to learn more.
Table of Contents
Google Sheets IF THEN Formula Syntax
Now that we understand what the Google spreadsheet IF THEN formula does, let’s look into the basic syntax of the function. It can be written as:
IF(logical_test, value_if_true, value_if_false)
The logical_test in the syntax usually is the condition you check in the function. It is an expression or reference to a cell containing an expression that would return a logical value, such as TRUE or FALSE.
One argument in the Google Sheet IF formula is value_if_true, which is the value the function returns if the logical_test is TRUE.
Lastly, the value_if_false, an optional parameter, is the value the function returns if logical_expression is FALSE. If the user hasn’t specified the value_if_false argument and the checked condition was not met, the result of the function would return FALSE.
How to Do IF THEN in Google Sheets (Step-By-Step Guide)
Below is a sample of a car purchasing decision table. It contains the buyer’s budget and the expected mileage of the vehicle. First, I will use the IF formula to determine whether the price is “Within Budget” or “Over Budget”:
Step 1: Go to the desired cell range where you want to display the results.
Step 2: Next we’ll be using the IF syntax of
Here’s how we substitute the values into the formula:
In the screenshot above, I have used the logical expression B6<B2, which means if the value in cell B6 is lower than the value in cell B2 then the “Value_if_True” should be displayed. Otherwise, the “Value_if_False” should be indicated.
We’ve entered “Within Budget” as our Value_if_True and “Over Budget” as our Value_if_False.
Nested IF Statements in Google Sheets
You can nest multiple IF statements in Google Sheets into the same formula to perform a longer, more complex logical test now that you know how to create an IF function with one statement. There are several ways to use an IF function in Google Sheets, including performing calculations in the value section.
Nesting AND/OR with IF Statements
Since the IF function performs logical tests with TRUE or FALSE outcomes, other logical functions such as AND and OR can be nestled within an IF formula. This enables you to run a preliminary test with multiple criteria. You must note that the AND function requires that all test criteria be met for a TRUE result to be displayed. OR a TRUE result needs only one of the test criteria to be correct.
Here’s how we would add a nested AND statement to our above example:
Here we want to use a combination of IF and AND to add a second parameter for the IF function to check, like so:
=IF(AND(Logical_Expression_1, Logical_Expression_2), "Value_if_True", "Value_if_False")
In the screenshot above, I have followed the same process for adding and IF statement, only this time, I have added an extra logical expression to check. Now we are also making sure the mileage is under 10800 using the logical expression C6<B3.
To use IF AND, you must simply substitute into these formulas:
=IF(AND(AND Argument 1, AND Argument 2), value_if_true, value_if_false)
You can add as many AND arguments as you like or use IF OR:
=IF(OR(OR Argument 1, OR Argument 2), value_if_true, value_if_false)
Nesting with Other IF Statements
Although working with multiple IF statements in Google Sheets may sound complex, you must simply type:
=IF(first test, value if true, IF(second test, value if true, value if false)
You can nest as many IF statements as you need. In addition to that, you can use a Google Sheet nested IF statement as the “value_if_true” argument in the same way. To do this, simply use the following syntax:
=IF(first_test, IF(second_test, value_if_true, value_if_false), value_if_false)
It is also worth noting that you can also use the Google IF function in conditional formatting. However, you cannot use the IF/THEN/ELSE syntax in a single rule in conditional formatting.
Frequently Asked Questions
How Do You Write an IF THEN Formula in Google Sheets?
Open your Google Sheets spreadsheet and then type the syntax of the IF THEN, which is =IF(logical_test, value_if_true, value_if_false) into a cell.
The logical test is what you want the statement to check against.
The first argument tells the function what to do if the comparison is true. The second argument tells the function what to do if the comparison is false.
Give this article a read in which I’ve explained everything you need to know on how to do an IF THEN statement in Google Sheets, which also applies to IF ELSE Google Sheets statements.
How Do You Add Multiple Conditions in an IF Statement in Google Sheets?
While adding multiple statements in an IF function alone is not possible, You may use the IFS function in Google Sheets to test numerous conditions at once and then return the result. The IFS function differs from the IF function in that it allows you to test many conditions at once. When all the conditions are determined to be TRUE, the matching value is returned.
Can I Use an IF Formula in Conditional Formatting in Google Sheets?
You certainly can. Conditional formatting in Google Sheets allows you to modify the aspect of a cell—for example, the background color or text style—based on rules you define. Each rule that you create is an IF/THEN expression. For example, you may say, “If cell B2 is empty, change the background color of that cell to black.”
However, the IF/THEN/ELSE syntax cannot be used in a single rule in conditional formatting. Only the IF/THEN logical test is used for conditional formatting. For conditional formatting to be implemented, it must return TRUE.
What’s the Difference Between IF and IFS?
Google Spreadsheets IFS examines numerous conditions, whereas IF examines only one.
Now we know how to write an IF statement in Google Sheets. If this guide didn’t answer all the questions you had about the Google Sheets IF THEN formula, we’d recommend checking out our Google Sheets IFS function guide next.