**Related Tutorial: ** Expanded Excel IF Function Step by Step Tutorial including screenshots

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

The syntax for the IF function is:

**=IF ( logical_test, value_if_true, value_if_false )**

logical_test - a value or expression that is tested to see if it is true or false.

value_if_true - the value that is displayed if logical_test is true.

value_if_false - the value that is displayed if logical_test is false.

### Example Using Excel's IF Function:

- Enter 35 into cell D1.
- Click on cell E1 - the location where the results will be displayed.
- Click on the
*Formulas*tab. - Choose
**Logical Functions**from the ribbon to open the drop down list. - Click on
*IF*in the list to bring up the function's dialog box. - On the
**Logical_test**line in the dialog box, click on cell D1. After this type the*less than*symbol (**<**) and then the number 26. - On the
**Value_if_true line**of the dialog box, type 100. - On the
**Value_if_false line**of the dialog box, type 200. - Click OK.
- The value 200 should appear in cell E1, since the value in D1 is greater than 26.

### Changing the IF Function's Results

- To change the result in cell E1, change the number in cell D1. For example, change E1 to 15 and press the
**Enter**key. - The value 100 should now be present in cell E1 since the value in D1 is now less than 26.
- If you click on cell E1, the complete function
**= IF ( D1 < 26 , 100 , 200 )**appears in the formula bar above the worksheet.