# How to Create IF Function to Return Yes or No in Excel

In this tutorial, you will learn how to create IF function to return yes or no in Excel.

The IF function in Excel performs a logical test and outputs two values: one for a TRUE outcome and another for a FALSE outcome. For instance, the formula for “passing” is =IF(A1>40,”Pass”,”Fail”). By nested IF functions, several conditions can be examined. The logical test can be extended by combining the IF function with other logical operations like AND and OR.

Once ready, we’ll get started by utilizing real-world examples to show you how to create IF function to return yes or no in Excel.

## Anatomy of IF Function

### IF Function

=IF(logical_test, value_if_true, value_if_false)

The Excel IF Statement evaluates a specified condition and outputs two values—one for a TRUE outcome and another for a FALSE one.

## Create IF Function to Return YES or NO in Excel

Before we begin we will need a group of data to create IF function to return yes or no 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 find out if the students have passed or failed any of the exams for the year. To do that, we will be using the IF function together with the AND function to make sure if any of the exams scores lower than 40 marks, the indicator will return a ‘Fail’. We will insert this formula =IF(AND(B2>=40, C2>=40, D2>=40), “Pass”, “Fail”).

### Step 3

Once you are done, apply the same formula to the rest of the data and your Excel will look like this.