1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Google Spreadsheet IF Function

Using the IF Function in a Google Spreadsheet

By

Google Spreadsheets IF Function

Google Spreadsheets IF Function

© Ted French

The Google Spreadsheet IF function allows you to use decision making in your worksheets.

The IF function tests to see if a certain condition in a spreadsheet cell is true or false.

If the condition is true, the function will carry out a specific operation. If the condition is false, the function will carry out a different operation.

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 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.

Note: When entering the IF function, the three arguments are separated by commas ( , ).

Example Using the Google Spreadsheet IF Function:

We will be entering the following IF function in cell A2:

= IF ( A1 < 26 , 100 , 200 )
What the function does is test to see if the value in cell A1 is less than 26. If A1 is less than 26, the function displays the number 100 in cell A2. If the value in A1 is greater than 26, the function displays 200 in cell A2.
  1. Enter 35 into cell A1

  2. Click on cell A2 - the location where the results will be displayed

  3. Type the equal sign ( = ) followed by the name of the function if

  4. As you type, an auto-suggest box appears with the names and syntax of functions that begin with the letter I

  5. When the name IF appears in at the top of the box, press the Enter key on the keyboard to enter the function name and open round bracket into cell A2

  6. Click on cell A1 on the spreadsheet to enter that cell reference

  7. After the cell reference, type the less than symbol ( < ) followed by the number 26

  8. Enter a comma to complete the test argument

  9. Type 100 followed by a comma to enter this number as the then_true argument

  10. Type 200 to enter this number as the otherwise_value argument - do not enter a comma

  11. Type a closing round bracket " ) " to complete the function's arguments

  12. Press the ENTER key on the keyboard to complete the function

  13. The value 200 should appear in cell A2, since the value in A1 is greater than 26

  14. To change the result in cell A2, change the number in cell A1 to 15 and press the Enter key

  15. The value 100 should now be present in cell A2 since the value in A1 is now less than 26

  16. If you click on cell A2, the complete function = IF ( A1 < 26 , 100 , 200 ) appears in the formula bar above the worksheet

©2014 About.com. All rights reserved.