- Formula Basics
- Summarizing Data Quickly
- Elements of Formulas
- Entering Formulas
- Determining the Order of Operations
- Understanding Cell References
- Using Cell References
- Understanding Comparison Operators
- Using Comparison Operators
- Understanding Functions
- Using Functions
- Copying and Moving Formulas
- Handling Errors
Using Comparison Operators
You can use cell references or constants in comparisons. The expression A1=A2, for example, is TRUE if cell A1 contains the same value as cell A2. Comparison operations mainly are used in IF, AND, OR, NOT, SUMIF, COUNTIF, and other functions that take expressions that can be evaluated as TRUE or FALSE. For example, the formula
=IF(B2=0, 0, B1/B2)
uses a comparison to avoid dividing by zero.
Comparisons don’t have to be embedded in functions; you can type them as stand-alone formulas. For example, the formula
=A1=5
will display TRUE or FALSE in a cell depending on the value in A1. Note that it’s clearer to enter this formula as
=(A1=5)
To insert a comparison operator in a formula:
- In the formula bar, position the insertion point where you want the operator to appear.
- If the comparison-operator keys aren’t visible on the left side of the formula keyboard, tap the &≤≠ key.
- Tap an operator key .