The Purpose of the Google If ( ) Function
The If( ) function tests whether a certain condition in a cell is true or false.
If the condition is true, the function will carry out one operation. If the condition is false, the function will carry out a different operation.
The initial true or false test, as well as the follow up operations, are set with the function’s arguments.
The If( ) Function’s Syntax and Arguments
A function’s syntax refers to the format in which the function must be stated. It includes the function’s name, brackets, comma separators, and arguments.
The syntax for the If( ) function is:
The function’s three arguments are:
Test: a value or expression that is tested to see if it is true or false Then_true: the operation that is carried out if the test is true Otherwise_value: the operation that is carried out if the test is false
Example of the Google Sheets If( ) Function
In row 3, the If() function returns various results such as:
This example:
Tests to see if the value in cell A2 is equal to 200 (the test argument)If it does, the function displays the value 1 in cell B3 (the then_true argument)If A1 does not equal 200, the function displays the value 2 in cell B3 (the optional otherwise_value argument)
How to Enter the If( ) Function
Unlike Excel, Google Sheets does not use dialog boxes for function arguments. Instead, it has an auto-suggest box that pops up as you type the name of the function into a cell.
To enter the function:
Click cell B3 to make it the active cell. Type the equal sign ( = ) followed by the name of the function if. As you type, the auto-suggest box appears with the names of functions that begin with the letter I. When IF appears in the box, click it to enter the function name and opening parenthesis or round bracket into cell B3. Click cell A2 in the worksheet to enter that cell reference. After the cell reference, type the equal symbol (=) followed by the number 200. Enter a comma to complete the test argument. Type 2 followed by a comma to enter this number as the then_true argument. Type 1 to enter this number as the otherwise_value argument. Do not enter a comma. Press Enter to insert a closing parenthesis ) and to complete the function. The value 1 should appear in cell B3, given that the value in A2 does not equal 200. If you click cell B3, the complete function appears in the formula bar above the worksheet.