Learning Excel: Comparisons
Comparing
Dave puts a cup of coffee down on the edge of the front desk. "Who's under 12? Who has an annual pass? Can't Excel just tell me?" It can: with a comparison.
TRUE or FALSE
A comparison asks a question whose answer is TRUE or FALSE. =B2>=12 asks: is Jack 12 or older?
Jack is 9, so H2 shows FALSE. An answer like that is called a logical value. It isn't text, but a kind of value of its own.
=B2>=12
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Name | Age | Pass | Visits | Paid | Category | Per visit | |
| 2 | Jack | 9 | Single | 3 | £15.00 | FALSE | ||
| 3 | Nora | 34 | Annual | 22 | £240.00 | |||
| 4 | Mila | 15 | Monthly | 9 | £25.00 | |||
| 5 | Rita | 67 | Annual | 15 | £240.00 | |||
| 6 | Laura | 41 | Single | £10.00 | ||||
| 7 | Rory | 7 | Monthly | 6 | £25.00 | |||
| 8 | Jim | 72 | Annual | 18 | £240.00 | |||
| 9 | Will | 28 | Single | 4 | £20.00 | |||
| 10 | Hannah | 12 | Monthly | 11 | £25.00 | |||
| 11 | Sara | 55 | Annual | 0 | £240.00 | |||
| 12 |
The operators
You compare with = (equal to), <> (not equal to), < and > (less than and greater than), and <= and >= (less than or equal to, greater than or equal to).
You compare text in quotation marks: =C2="Single". Upper and lower case don't matter.
Watch out for Hannah: her age sits on the left of the cell, because someone typed it as text. To Excel, text is always greater than any number.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Name | Age | Pass | Visits | Paid | Category | Per visit |
| 2 | Jack | 9 | Single | 3 | £15.00 | ||
| 3 | Nora | 34 | Annual | 22 | £240.00 | ||
| 4 | Mila | 15 | Monthly | 9 | £25.00 | ||
| 5 | Rita | 67 | Annual | 15 | £240.00 | ||
| 6 | Laura | 41 | Single | £10.00 | |||
| 7 | Rory | 7 | Monthly | 6 | £25.00 | ||
| 8 | Jim | 72 | Annual | 18 | £240.00 | ||
| 9 | Will | 28 | Single | 4 | £20.00 | ||
| 10 | Hannah | 12 | Monthly | 11 | £25.00 | ||
| 11 | Sara | 55 | Annual | 0 | £240.00 | ||
| 12 |
Try it yourself
Does Nora have an annual pass? Make H3 say so with a comparison.
| A | B | C | D | E | F | G | H | I | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Name | Age | Pass | Visits | Paid | Category | Per visit | ||
| 2 | Jack | 9 | Single | 3 | £15.00 | ||||
| 3 | Nora | 34 | Annual | 22 | £240.00 | ||||
| 4 | Mila | 15 | Monthly | 9 | £25.00 | ||||
| 5 | Rita | 67 | Annual | 15 | £240.00 | ||||
| 6 | Laura | 41 | Single | £10.00 | |||||
| 7 | Rory | 7 | Monthly | 6 | £25.00 | ||||
| 8 | Jim | 72 | Annual | 18 | £240.00 | ||||
| 9 | Will | 28 | Single | 4 | £20.00 | ||||
| 10 | Hannah | 12 | Monthly | 11 | £25.00 | ||||
| 11 | Sara | 55 | Annual | 0 | £240.00 | ||||
| 12 |
Ready for more?
The full lesson has 5 exercises, from easy to challenging, with hints, points and a streak you can build.
Start the lesson