Software & Apps Google Drive How to Use the Google Sheets If( ) Function Using the If( ) formula for logical functions By Ted French Writer Former Lifewire writer Ted French is a Microsoft Certified Professional who teaches and writes about spreadsheets and spreadsheet programs. our editorial process Ted French Updated March 25, 2020 Google Drive Sheets Docs Slides Tweet Share Email As with Excel's If( ) function, the If () function in Google Sheets facilitates branched decision-making within a worksheet. 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. These steps and screenshots are for the desktop version of Google Sheets, but the directions also work in the mobile app. Nest If( ) statements to test several conditions and to carry out different operations depending on the outcome of the tests. Lifewire / Michela Buttignol 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: =if(test, then_true, otherwise_value) The function's three arguments are: Test: a value or expression that is tested to see if it is true or falseThen_true: the operation that is carried out if the test is trueOtherwise_value: the operation that is carried out if the test is false The otherwise_value argument is optional, but you must specify the first two arguments for the function to process correctly. Example of the Google Sheets If( ) Function In row 3, the If() function returns various results such as: =if(A2=200,1,2) 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) If you decline to enter an otherwise_value argument, Google Sheets will return the logical value 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 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 A2, 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.