Table of Contents
The “=IF(logical_test, “Yes”, “No”)” is a formula used in spreadsheet programs to evaluate a logical test and return a value of “Yes” if the test is true, or “No” if the test is false. This formula is commonly used to make decisions or display results based on certain conditions. It follows the syntax of “IF(logical_test, value_if_true, value_if_false)”.
Excel: Create IF Function to Return Yes or No
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(A2<>B2, "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.
The following tutorials explain how to perform other common tasks in Excel:
Cite this article
stats writer (2024). =IF(logical_test, “Yes”, “No”). PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/iflogical_test-yes-no/
stats writer. "=IF(logical_test, “Yes”, “No”)." PSYCHOLOGICAL SCALES, 26 Jun. 2024, https://scales.arabpsychology.com/stats/iflogical_test-yes-no/.
stats writer. "=IF(logical_test, “Yes”, “No”)." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/iflogical_test-yes-no/.
stats writer (2024) '=IF(logical_test, “Yes”, “No”)', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/iflogical_test-yes-no/.
[1] stats writer, "=IF(logical_test, “Yes”, “No”)," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. =IF(logical_test, “Yes”, “No”). PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
