Logical

Choosing a word from a text test

Definition

Choosing a word from a text test means writing an IF formula that compares a label and returns one of two words.

Syntax

=IF(logical_test, value_if_true, value_if_false)

Arguments

Argument Meaning
logical_test The text comparison, such as B2="idle".
value_if_true The word to show when the test is true. Wrap it in double quotes.
value_if_false The word to show when the test is false. Wrap it in double quotes.

Worked example

A gate sheet stores a status word in B2 and should show yes only when that word is idle.

A: Gate B: Status
North busy
East idle
West busy

Formula: =IF(B2="idle","yes","no")

Result: no. busy is not idle, so the false word is shown.

Practice

Cell A2 holds open. In B2, write a formula that shows yes when A2 is open, and no otherwise.

  1. In B2, write an IF formula that shows yes when A2 is open, and no otherwise.
Step 1 of 2
Formulas here use English function names, such as SUM, and a period as the decimal separator, in every language.
Loading the sheet…

Related functions

IF is the function that returns one of those two words from the text test.

Common mistake

Leaving the quotes off the test word, as in =IF(B2=idle,"yes","no"): idle is then read as a name, and the formula returns #NAME? instead of no.

Related functions

These links are related functions.