How To Write If Statement In Google Sheets

The power of spreadsheet lies in leveraging its inbuilt functions. One of the most fundamental, yet powerful tool in Google Sheets is the “IF” statement. It’s a function that tests a particular condition and returns a value based on whether that condition is true or false.

The core syntax of an IF statement in Google Sheets is =IF(logical_expression, value_if_true, value_if_false). It follows a conditional structure known as ‘if-then-else’. If the logical expression is true, then the value_if_true is returned, else the value_if_false is returned.

Steps to Write an If Statement

  1. Open your Google Sheets and select the cell where you want to use the IF function.
  2. Type =IF( to begin the function.
  3. Next, enter your logical expression. This could be anything like A2>10, B3=”Yes”, D4<=5, etc.
  4. After the logical expression, add a comma (,) and then the value or action to return if the condition is true.
  5. Afterward, add another comma (,) and then the value or action to return if the condition is false.
  6. Finally, close the function with a closing parenthesis ()), and then hit ‘Enter’ to apply the function.

Example of an IF Statement

Let’s say we have a list of students with their grades and we want to determine who has passed or failed, considering that a score of 50 is the passing grade. We could use an IF statement to solve this.

In the cell where we want to display the result, we would write the following formula:

        =IF(B2&gt;=50, "Passed", "Failed")
        

This formula simply means: if the grade in cell B2 is greater than or equal to 50, then print “Passed”, else print “Failed”.

By dragging the corner of the cell with the formula, you can apply this condition to the entire column quickly.

IF statements in Google Sheets are easy to learn, user-friendly, and immensely powerful when dealing with large data. Once you get the hang of it, you’ll find it an indispensable tool in your data analysis tasks.