Comparisons: TRUE or FALSE
Ask yes/no questions about your data with =, <>, <, >, <= and >=. Beginner · 4 min · = and <>, < > <= >=, TRUE/FALSE
A comparison asks a yes/no question about your data, and the answer is always TRUE or FALSE. There are six comparison operators:
=equal to,<>not equal to<less than,>greater than<=less than or equal to,>=greater than or equal to
So =B2<C2 reads as "is B2 less than C2?". On their own, comparisons make handy flags. Inside IF, AND and COUNTIF they drive every decision a spreadsheet makes.
Steps
A plant needs reordering when its stock is at or below its reorder level. In
E2, type=B2<=C2, then copy it down toE7.Which plants come from the Fernhill nursery? In
F2:F7, compare each supplier with the text Fernhill. Text inside a formula needs double quotes:=D2="Fernhill"In
G2:G7, flag the plants you can sell today: their stock is not equal to 0. Use the<>operator.Everything is heading to a weekend market. In
B10, check whether the total stock is greater than the stall capacity inB9. Either side of a comparison can be a calculation, so you can start with a SUM.
Remember
- Comparisons return
TRUEorFALSE. <=and>=include the boundary value;<and>don't.- Text goes in double quotes and matches regardless of capital letters.
- Either side of a comparison can be a cell, a value or a whole calculation.
Previous: Percentages and number formats · Next: The IF function