Menu
Coddy logo textTech

Writing an IF

Part of the Fundamentals section of Coddy's Excel journey — lesson 35 of 42.

Time to write your own IF. The recipe is always the same three steps. Step 1: ask the question, compare a cell to a value, like B1>=60. Step 2: write the answer for yes, in quotes if it's text. Step 3: write the answer for no.

=IF(B1>=60, "pass", "fail")

Read it out loud: if B1 is at least 60, show pass, otherwise show fail. If you can say it, you can write it.

Two classic mistakes to dodge. Forgetting the quotes around text answers, =IF(B1>=60, pass, fail) is an error, because Excel doesn't know what a bare pass is. And swapping the answers, the true answer always comes first, right after the condition.

One more detail worth noticing: >= means at least, so a score of exactly 60 passes. If the rule were B1>60 instead, 60 would fail. Small symbol, big difference.

challenge icon

Challenge

Beginner

The sheet holds a test score: the label Score in A1 and the score itself in B1.

In C1, write an IF that shows pass when the score is at least 60, and fail otherwise. Use exactly those two words, in lowercase.

Your formula will be tested with different scores, including one sitting exactly on 60, so make sure you pick the right comparison symbol.

Try it yourself

Sheet1
ABCDEFG
1Score72
2
3
4
5
6
7
8
9
10
11
12
13
14
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals