**What the IF function does**

The IF function is one of Excel’s most useful and most used functions. What it does, basically, is test to see whether a certain condition is true or false. If the condition is true, the function will do one thing, if the condition is false, the function will do something else.

The basic form or syntax of the function is:

=IF(logic test, value if true, value if false)

The logic test is always a comparison between two values. Comparison operators are used, for example, to see if the first value is greater than or less than the second, or equal to it.

While the logic test section is limited to answering a true or false question, you have greater flexibility in what you place in the last two arguments.

**Entering Data with the IF Function**

The IF function can be set up to enter data into a target cell. This data could then be used in other calculations. For example, a quiz setup in Excel could use IF functions to determine if the student’s responses to questions are correct.

If they are correct, the function returns a mark for that question. If the student gets the question wrong, a zero is returned in the mark column. At the bottom of the mark column, the SUM function can be used to total the student’s score on the quiz.

**Examples**

A math quiz ask the question “what is 5 X 7 equal to?” the IF function that would check to see if the answer was correct and, if so, give the student a mark would be:

=IF(A5 = 35,1,0)

Similarly, a geography quiz could ask “What is the capital of Australia?” An IF function that would check to see if that answer was correct and give the student 5 marks would be:

=IF(A5 = “Canberra”,5,0)

**Related tutorials on the IF Function:**