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.
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
On line 3, the If() function returns various results such as:
= Если (А2 = 200,1,2)
- 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 .