Using the IF function, it is possible to analyze text, values, and even errors. It extends beyond simply determining whether two things are equal and then giving one answer. Based on our needs, we can also use mathematical functions and perform extra calculations. It allows us to combine numerous functions together for several tests. This article will show you how to use the IF function with a yes or no statement in Excel.
Introduction to IF Function
Objective
The Excel IF function performs a test on a specified condition and outputs two values: one for a TRUE outcome and another for a FALSE one.
Syntax

=IF(logical_test, value_if_true, value_if_false)Arguments Explanation
| Argument | Required/Optional | Argument Explanation |
|---|---|---|
| Logical_test | Required | This is the condition to be tested and evaluated as either TRUE or FALSE. |
| Value_if_true | Optional | The value that will be returned if the logical_test evaluates to TRUE. |
| Value_if_true | Optional | The value that will be returned if the logical_test evaluates to FALSE. |
Available in:
- The IF function is available from Microsoft Excel 2000.
- Here, we will use Microsoft Excel 365.
3 Suitable Examples to Use IF Statement with Yes or No in Excel
This article will demonstrate how to use the IF function with yes or no statements in Excel. So, we will determine some yes or no comments on the basis of the text, numbers, and different criteria.
Example 1: Applying IF Function for Numbers with Yes or No Statement in Excel
In the first section, we will show how to make an action a comment with a yes or no statement in a sample data set of unit sales and a targeted unit sale column to know how many units have sold.

- Firstly, select cell D5.
- Secondly, write down the following formula.
=IF(B5>=C5,"Yes","No")
- Then, press Enter and use the Fill Handle to drag rightward to the remaining cells to see the result.

Read More: Excel IF Statement Between Two Numbers
Example 2: Using IF Function for Text with Yes or No Statement in Excel
So, in this section, we will show how to make comments with yes or no statements in a sample data set of multiple products and their delivery status.

- Firstly, select cell D5.
- Then, write down the following formula.
=IF(C5="Delivered","Yes","No")
- Afterward, press Enter and use the Fill Handle to drag rightward to the remaining cells to see the result.

Read More: How to Check If Cell Contains One of Several Values in Excel
Example 3: Employing IF Function for Specific Criteria with Yes or No Statement
Finally, in this section, we will demonstrate how to find a specific color with a yes or no statement in a sample data set of multiple colors with specific criteria.

- Firstly, choose cell C5.
- Secondly, write down the following formula.
=IF(B5="White","Yes","No")
- After that, press Enter and use the Fill Handle to drag rightward to the remaining cells to see the result.

Read More: How to Use If Statement Based on Cell Color in Excel
Download Practice Workbook
You may download the following Excel workbook for better understanding and practice it by yourself.
Conclusion
In this article, we’ve covered 3 suitable examples of how to use the IF function with a yes or no statement in Excel. We sincerely hope you enjoyed and learned a lot from this article. If you have any questions, comments, or recommendations, kindly leave them in the comment section below.
Related Articles
- How to Use Conditional Formatting If Statement Is Another Cell
- How to Find Sum If Cell Color Is Green in Excel
- Prepare IF Statement Contains Multiple Words in Excel
- How to Use Wildcard with If Statement in Excel
- Show Cell Only If Value Is Greater Than 0 in Excel



I have been doing a lot of long if statements in Excel for over 40 years, but cannot seem to get this one to work. I admit this is the first time I have tried to put together an IF statement involving a COLOR. Been trying to get this simple formula to work for a couple of hours. I have a column of numbers in column E in different colors. I am trying to get an IF statement to work whereby if E1 is green, then the IF statement places the number in F-1, otherwise leave F-1 blank. At the end, I have to sum the numbers in column F.
Tried this and it did not work. =if(e1=”Green”,E1,” “)
Hello Othell,
The issue is that a regular IF formula cannot directly check a cell’s font color or fill color. In your formula,
=IF(E1=”Green”,E1,””)
Excel is checking whether the actual value in E1 is the text “Green”, not whether the cell is colored green.
If the green color is applied based on a rule or condition, the best approach is to use that same condition in the IF formula. For example, if values greater than 50 are colored green, you could use:
=IF(E1>50,E1,””)
Then copy the formula down column F and sum the results with:
=SUM(F:F)
If you need to detect the cell color itself, you would need to use VBA or a named formula using the older GET.CELL function, because Excel does not have a standard worksheet function such as IF(E1=”Green”,…) for checking colors.
If you let us know whether the green color is applied manually or through Conditional Formatting, we can suggest the most suitable method.
Regards,
ExcelDemy