Text size17
All Excel lessons

Excel · Lesson 15

Ask a yes/no question with IF

4 min readIntermediate — no prior experience needed

Sometimes you want a cell to answer a yes or no style question automatically, such as whether a score counts as a pass. By the end of this page you will be able to write a simple IF formula that makes that decision for you.

IF is a function that checks whether something is true or false, and then shows one result if it is true, and a different result if it is false. It behaves much like a decision you might make yourself: if the score is 50 or more, say Pass, otherwise say Review.

IF turning scores into Pass or Review. IF checks whether A2 is 50 or more, then shows "Pass" if true and "Review" if false.
  • The score being tested
  • The three parts: test, true, false
  • The result Excel chooses

An IF formula always has three parts, separated by commas, inside the brackets: the test you want checked, what to show if that test is true, and what to show if it is false. So the shape is =IF(test, value if true, value if false). If you want the result to be a word rather than a number, that word must be wrapped in straight double quotation marks, such as "Pass", so Excel knows to treat it as text rather than trying to read it as a formula or a name.

Try it yourself

  1. In cells A2 to A6, type five test scores, such as 45, 62, 50, 38 and 71.

    This gives IF some real numbers to test against.

  2. In B2, type =IF(A2>=50,"Pass","Review") and press Enter.

    This checks whether A2 is 50 or more; if it is, the cell shows Pass, and if not, it shows Review.

  3. Use the fill handle to copy the formula from B2 down to B6.

    This applies the same Pass or Review test to every score in the list, each one checked against its own row.

  4. Change one of the scores in column A to see the word in column B update automatically.

    This confirms the formula is genuinely testing the number, not just showing fixed text.

  5. Try changing the test to A2>60 instead of A2>=50, and see which results change.

    This shows how adjusting the condition itself changes which rows count as a pass.

Words people use

IF function
A function that tests whether something is true or false and shows a different result for each case.
Condition
The test written first inside an IF formula, such as A2>=50.
Text in a formula
Words used inside a formula must be wrapped in straight double quotation marks so Excel treats them as text.

IF is often the first 'proper' function people learn that involves genuine decision-making rather than just arithmetic, and it opens the door to much more advanced formulas later, all built on this same true or false idea.

Check yourself

If you can say yes to each of these, you are ready for the next lesson.

  • I understand that IF tests something and gives one of two answers.
  • I can write an IF formula with a condition, a true result and a false result.
  • I know to wrap text results in double quotation marks.
  • I have used IF to sort scores into Pass and Review.

Want to keep track of what you have finished? Sign in — completely optional, and every lesson stays free either way.