*60*

You can use the following basic syntax to create an IF function in Excel that returns “Yes” or “No” as a result:

=IF(A2>=B2, "Yes", "No")

For this particular formula, if the value in cell **A2** is greater than or equal to the value in cell **B2**, the function returns “Yes.”

Otherwise it returns “No.”

The following examples show how to use this syntax in practice.

**Example: Create IF Function to Return Yes or No in Excel**

Suppose we have the following two columns in Excel that show the sales and sales targets for ten different products:

We can type the following formula into cell **C2** to return “Yes” if the number of sales in cell **A2** is equal to or greater than the sales target in cell **B2**:

=IF(A2>=B2, "Yes", "No")

We can then drag and fill this formula down to each remaining cell in column C:

The formula returns either “Yes” or “No” depending on whether or not the sales value in column A is greater than or equal to the sales target in column B.

Note that you can place any logical test you’d like in the first argument of the IF function.

For example, you could use to test if the values in cell **A2** and **B2** are not equal to each other and return “Yes” if they’re not equal or “No” if they are equal:

=IF(A2B2, "Yes", "No")

We can then drag and fill this formula down to each remaining cell in column C:

The formula returns “Yes” if the sales and sales target are not equal.

Otherwise, the formula returns “No” if the sales and sales target are equal.

Feel free to use whatever logical test you’d like in the first argument of the IF function depending on what condition you’d like to test.

**Additional Resources**

The following tutorials explain how to perform other common tasks in Excel:

Excel: How to Use an IF Function with 3 Conditions

Excel: How to Use an IF Function with Range of Values

Excel: How to Use an IF Function with Dates