In this article:

How to Use the Google Sheets IF Function (The Right Way!)

December 5, 2024

The IF function in Google Sheets…
 

The IF function is one of the simplest tools in Google Sheets and also one of the most powerful. It works to check for a particular condition across the cells in your spreadsheet and to return one value when the condition is met and another when it is not. As a standalone tool, it is a great way to help sort data and automate a tedious input process. It’s also an essential building block to perform more complex operations in concert with other tools. 

IF Function Google Sheets Syntax

=IF(logical_expression, value_if_true, [value_if_false])

Where: 

logical_expression=

The condition for which each cell will be checked. Google Sheets allows you to indicate the condition with a number or an exact string of text and at least one of the following logical operators:  

  • Equals (=)
  • Not equal to (<>)
  • Greater than (>)
  • Greater than or equal to (>=)
  • Less than (<)
  • Less than or equal to (<=)

value_if_true=

The value returned if the condition is TRUE.

 value_if_false=

The final, optional argument allows you to specify a value to be returned when the condition is FALSE. When left blank, it will simply return no value for the cells in which the logical expression is FALSE.

IF Function Google Sheets Examples

Using The IF Function With A Single Condition

We’ll walk you through the basics of the Google Sheets IF function by starting with its primary purpose: producing different values based on the TRUE or FALSE result of a logical expression, such as equal to (=) or greater than (>). 

Let’s say a group of ten students were given a placement test to determine which of two classes they would be taking for the semester—with students who scored 50 or higher going to Class A and students scoring 49 or lower going to Class B. We can use the IF function to automatically populate the Assignment column based on the data in the Score column.  

IF function Google Sheets

1. Type =IF( in the appropriate cell

Google Sheets IF function

Choose the first cell you’d like the function to populate and enter the first part of the syntax. In cases like our example, where you want to fill a whole column with results produced by a corresponding one, begin at the top. 

2. Add your condition 

IF statement Google Sheets

We want the function to check the preceding cell in the row for a value greater than or equal to 50. To do so, we simply select the relevant cell, add our logical operator (in this case: >=), and the number to which it applies (50). 

3. Add the value returned for a TRUE result 

IF Google Sheets

For the second argument, simply enter the value you want the function to return when the condition is calculated as TRUE. In cases where the value is a string of text rather than a numeral, encase it in quotation marks. In our example, we want the function to assign students to the proper class. Those who scored greater than or equal to 50 go to Class A. 

4. Add the value returned for a FALSE result

How to use if function in Google Sheets

In our example, we want students who scored 49 or lower—and thus did not meet the condition indicated by our logical expression—to be assigned to Class B, so we simply enter the text embedded in quotation marks. In cases where you only want a value produced for a TRUE result, you can leave this final argument blank. 

5. Type ) and hit return 

IF statements in Google Sheets

Close out the syntax and hit return to see your result. 

6. Fill remaining cells

IF formula Google Sheets

With the first row completed, you don’t need to manually enter the syntax in the remaining cells of the column. Simply accept Google Sheets’ autofill suggestion or use the mouse to select the cell containing the formula and drag to apply it to the relevant cells. 

Using The IF Function with Text

You can also use it to generate a value from cells populated by an exact string of text.

Continuing from our previous example, let’s say that the students in Class A will be participating in the school’s advanced track and we want another column to indicate whether or not a student is on that track. 

1. Type =IF( in the appropriate cell

2. Add your condition 

Google Sheets tutorial

Select the appropriate cell, add the equals sign (=) and enter the text in quotation marks. Because the function relies on logical operators, the cell must only include the quoted text—it will not recognize cells in which the quoted text forms only a part. 

3. Add the value returned for a TRUE result 

4. Add the value returned for a FALSE result-

5. Type ) and hit return 

6. Fill remaining cells with the formula

Google Sheets how to

Sample Sheet

Click here to access our example spreadsheet where you can practice and master this essential skill.

Related Functions

This helpful function in Google Sheets can also be harnessed as a building block to perform more complex tasks in combination with other functions and operators. Here are some of the other if functions you can use:

SUMIF: SUMIF sums data in a range which meet a specific condition.

SUMIFS: Use SUMIFS to tally numbers in a range that meet more than one condition.

COUNTIF: In Google Sheets, COUNTIF can be used to count numbers in a range which meet a given criterion.

COUNTIFS: Counts numbers in a range meeting multiple different criteria.

COUNT IF Not Empty: Learn how to count cells that are not empty.

IFS: IFS is a more elegant way to evaluate data against multiple criteria. 

IFERROR: IFERROR is a tool that searches Google Sheets data for errors and replaces error messages with specified text or a blank cell. 

IF THEN: IF THEN in Google Sheets allows you to evaluate data against a condition and take a corresponding action when the result is TRUE. 

IF AND: Combining the IF and AND functions allows you to include multiple conditions that must be met to return a TRUE result.

IF ELSE: Google Sheets’ IF ELSE statement evaluates a condition, and takes one action when the result is TRUE and a different one when the result is FALSE.

Multiple IF statements: Nesting multiple IF arguments allows you to for TRUE or FALSE results against more than one logical expression


IF OR: IF OR evaluates multiple conditions and produces a TRUE result when any of them are met.

IF Contains: By combining three different Google Sheets tools, you can search for cells that contain particular text. 

AVERAGEIF: Use AVERAGE IF to calculate an average for numbers within a data range which meet provided criteria. 

If you want to learn how to send emails from Google Sheets, we suggest checking out our easy step-by-step guide

Get Google Sheets productivity and automation tips delivered straight to your inbox
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
We'll email you 1-3 times a week — and never share your information.

Work less, automate more!

Use Lido to connect your spreadsheets to email, Slack, calendars, and more to automate data transfers and eliminate manual copying and pasting. View all use cases ->