Like in case of function If() in Excel function If() in Google Sheets makes it easier to make branching decisions on a sheet. The If() function checks if a certain condition in a cell is true or false.

  • If the condition is true, the function will perform one operation.
  • If the condition is false, the function will perform another operation.

The initial true or false test, as well as subsequent operations, are set with arguments functions .

These steps and screenshots are for the desktop version of Google Sheets, but the directions also work on the mobile app.

Nest If() statements to test multiple conditions and perform different operations depending on test results.

If a function in Google Sheets
Lifewire / Michela Buttignolles

Syntax and arguments of the If() function

Syntax functions refers to the format in which the function must be specified. It includes the function name, brackets, comma separators, and arguments.

Syntax for the if() function:

= if (test, then_true, иначе_value)

Three function arguments:

  • Test: the value or expression that is tested to see if it is true or false
  • Then_true : operation to be performed if the check is true
  • Else_value: operation to be performed if the test is false

Value_if_condition_is_not_fulfilled the argument is optional, but you must correctly specify the first two arguments for the function to process.

Google Sheets If() function example

Google Spreadsheets IF Function / Statement

On line 3, the If() function returns various results such as:

= Если (А2 = 200,1,2)

This example:

  • Checks if the value in cell A2 is equal to 200 ( argument test )
  • If so, the function displays the value one in cell B3 ( argument then_true )
  • If A1 is not equal to 200 , the function outputs a value 2 in cell B3 (additional value_if_condition_is_not_fulfilled argument)

If you refuse to enter value_if_condition_is_not_fulfilled argument, Google Sheets returns a boolean FALSE .

Entering the If() function

Unlike Excel, Google Sheets does not use dialog boxes for function arguments. Instead, it has an auto-suggest box that appears when you type a function name into a cell.

To enter a function:

  1. Click on a cell b3, to make her active .

  2. Enter equal sign (=), and then the function name if .

  3. When you enter text, an automatic suggest box appears with function names. that start with a letter I .

  4. When IF appears in the box, click it to enter the function name and an opening parenthesis or parenthesis in cell B3.

    Screenshot of Google Sheets window showing = if features menu
  5. Click a cell A2 on the worksheet to enter link for this cell .

  6. After the cell reference, type an equal sign (=) followed by a number 200.

  7. Enter a comma to complete test argument.

  8. Enter 2 and a comma to enter this number as argument then_true .

  9. Enter one to enter this number in quality value_if_condition_is_not_fulfilled argument. Do not enter a comma.

    Screenshot of Google Sheets window with display=IF(A2=200,2,1)
  10. Click enter, to insert a closing bracket ) and end the function.

  11. The value 1 should appear in cell A2, given that the value in A2 is not 200.

    Screenshot of Google Sheets window with value 1 in cell B3
  12. If you click a cell B3 the full function will appear in the formula bar above the worksheet.

Похожие записи