Google Sheets If() function

  1. Using the If() formula for Boolean functions
  2. Syntax and arguments of the If() function
  3. Google Sheets If() function example:
  4. Entering the If() function

Using the If() formula for Boolean functions

Similar to the If() function in Excel, the If() function in Google Sheets makes it easier to make branching decisions on a sheet. The If() function checks whether a given condition in a cell is true or false.

  • If the condition is true, the function performs one operation.

  • If the condition is false, the function performs another operation.

The initial true or false test, as well as subsequent operations, are set using the function’s arguments.

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

Syntax and arguments of the If() function

Function syntax refers to the layout of the function and includes the function name, parentheses, comma separators, and arguments.

Syntax for the if() function:

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

Three function arguments:

  • test: the value or expression being tested to see if it is true or false
  • then_where : operation to be performed if test is true
  • else_value: operation to be performed if: test is wrong

Argument else_value is optional, but you must provide the first two arguments for the function to process correctly.

Google Sheets If() function example:

The if() function returns several results, such as:

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

shown in line 3 of the example.

What this example does:

  • Verify that the value in cell A2 is equal to 200 (argument test

  • If yes, then the function returns the value a in cell B3 (argument then_where

  • If A1 is not equal to 200 function returns value: 2 in cell B3 (optional argument else_value

If you do not enter an argument else_value Google Sheets returns a boolean false

Entering the If() function

Google Sheets does not use dialog boxes for entering function arguments, which are found in Excel. Instead it has a field automatic offer The that appears when the function name is entered in a cell.

To enter a function:

  1. Click on a cell B3 to make it active.

  2. Enter equal sign (=) and job title if

  3. As you type, a window appears. automatic accompaniment with function names that start with a letter I

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

  5. Click on a cell A2 on the sheet to enter a reference to that cell.

  6. Enter after the cell reference equal sign (=) and then a number 200

  7. Enter comma to complete the argument test

  8. Enter 2 and then comma to enter this number as an argument then_where

  9. Enter a to enter this number as an argument else_value – do not enter a comma.

  10. Fill in the function arguments.

  11. Press key Enter on the keyboard to insert a closing parenthesis and end the function.

  12. The value 1 should appear in cell A2 because the value in A2 is not 200.

  13. When you click on a cell B3 full function

appears in the formula bar above the worksheet.

Leave a Reply

Your email address will not be published.