How do I create an [IF FUNCTION] to return [YES] or [NO] in [GOOGLE SHEETS]?

 


You can use the following basic syntax to create an IF function in Google Sheets 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 Google Sheets

Suppose we have the following two columns in Google Sheets 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:

Google Sheets IF function to return yes or no

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 equal to each other and return “Yes” if they’re equal or “No” if they are not 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 equal.

Otherwise, the formula returns “No” if the sales and sales target are not 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.

x