What you will learn
- Compare numbers with signs like > and <
- Pick one of two answers with IF
How it works
IF has three parts, split by commas:
- the test (the question)
- the answer if it's true
- the answer if it's false
Signs: = equal, <> not equal, > greater than, < less than, >= greater than or equal to, <= less than or equal to.
Put words in quotes, like "Pass".
Formulas at a glance
=IF(test, if_true, if_false) | The pattern to follow |
=IF(B2>=60,"Pass","Fail") | The pattern to follow |
Example
Write the formula to show "Pass" if Ana's score is 60 or more. Otherwise show "Fail".
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Student | Score | Result | Bonus | Final |
| 2 | Ana | 88 | |||
| 3 | Ben | 54 | |||
| 4 | Cleo | 95 | |||
| 5 | Dev | 61 | |||
| 6 | Eli | 47 | |||
| 7 | Fay | 77 |
Click C2 and type =IF(B2>=60,"Pass","Fail"), then press Enter.
The answer is Pass.
When to use it
- Pass or Fail from a score
- Showing "Over" when spending is above budget
- Any label that depends on a number
Common mistakes
- Leaving out the quotes on wordsWords go in quotes: "Pass".
- Using => instead of >=The sign is >= (greater than or equal to).
- Missing a commaIF has three parts split by two commas.
Quick check
Which formula shows "Yes" when A1 is more than 10?
=IF(A1>10,"Yes","No")=IF("Yes",A1>10,"No")=IF(A1>10,Yes,No)=IF(A1>10)"Yes"
Show the answer
A. =IF(A1>10,"Yes","No") Test first. Then the true answer. Then the false answer. Words need quotes.
Practice it on a real sheet
Reading is a start. Doing it is how it sticks. This lesson walks you through every click on a live spreadsheet and checks each answer.