# How to Use the IF Function in Excel

In this tutorial, you will learn how to use the IF function in Excel.

One of the most used functions in Excel is the IF function, which enables you to compare values logically to expectations. Thus, an IF statement can produce two outcomes. If your comparison is True, the first result is what you get; if it’s False, the second.

Once ready, we’ll get started by utilizing real-world examples to show you how to use the IF function in Excel.

## Use the IF function in Excel

Before we begin we will need a group of data to be used to use the IF function in Excel.

### Step 1

First, you need to have a clean and tidy group of data to work with.

### Step 2

In this example, we want to know the grades for all students if they failed or pass by seeing the exam marks they have gotten. To do so, we can simply use the IF function in a formula like this =IF(B2>39,”Pass”,”Fail”).

### Step 3

Once you press Enter, your formula will return the grades for all the students.

### Summary

That’s all there is to it. You are welcome to copy the example spreadsheet below to see how it is done. The most crucial lesson is to enjoy yourself while doing it.

In this tutorial, I covered how to use the IF function in Excel.