Sub topic 8
Entering formulas with an equals sign
This chapter assumes you can select cells, type and commit an entry with Enter, and edit a cell with F2. You should also know that Excel decides whether an entry is text, a number, a date, or a formula.
The equals sign starts a formula
Excel treats an entry as a formula when it begins with =. Without the equals sign, Excel stores what you typed as text. For example, A2*B2 is just text, while =A2*B2 calculates a result.
A formula cell has two faces. The cell shows the result. The formula bar shows the formula itself. This is the stored-versus-displayed split from the previous chapter, applied to calculations.
=A2*B2Type this into C2 and press Enter. C2 shows the product of A2 and B2. Select C2 again and the formula bar shows =A2*B2.
Typing references versus pointing
You can type cell references, or you can point to them. Pointing means clicking or arrow-keying to a cell while the formula is open.
- Select C2 and type
=. - Click A2. Excel inserts
A2and outlines the cell. - Type
*, then click B2. - Press Enter to commit.
Pointing avoids typos in references. It also shows you which cells the formula uses, because Excel color-codes each reference and outlines the matching cell.
Because the formula holds references, not copies of the numbers, the result updates when A2 or B2 changes.
Enter mode and Edit mode with arrow keys
While you build a formula, the status bar shows Enter or Point. In Point mode the arrow keys move the reference. If you want the arrow keys to move the text cursor instead, press F2 to switch to Edit mode.
A common mistake is pressing an arrow key to finish an entry. In a formula, that inserts a reference instead of committing. Use Enter or Tab to commit, and Esc to cancel.
Common ways formulas go wrong
| Symptom | Likely cause | Fix |
|---|---|---|
| The cell shows `=A2*B2` as text | The cell was formatted as Text before you typed, or a space or apostrophe came before `=` | Set the format to General, then re-enter with F2 and Enter |
| The result does not change when inputs change | Calculation is set to Manual | On the Formulas tab, set Calculation Options to Automatic |
| `#NAME?` | A misspelled function or an unquoted text string | Correct the spelling or add quotation marks |
| `#DIV/0!` | The divisor is zero or empty | Check the cell you divide by |
| `#REF!` | A referenced cell was deleted | Rewrite the reference |
Changing the format to General does not convert a cell that already holds text. You must re-enter it: press F2, then Enter.
Formulas that produce text
A formula can also return text, which is useful for the leading-zero problem from earlier. This formula returns the number in A1 as text padded to five digits.
=TEXT(A1,"00000")If A1 holds 123, the result is 00123. The result is text, so you cannot use it directly in arithmetic. Text inside a formula must be wrapped in straight double quotation marks.
Exercise
You type =B2+B3 into B4, and the cell displays =B2+B3 instead of a number. You then change the cell format to General, but it still shows the text. Why, and how do you fix it?
Show answer
The cell was formatted as Text when you entered the formula, so Excel stored the entry as text. Changing the format afterward does not re-evaluate existing contents. Press F2 to edit the cell, then press Enter to re-commit it, and Excel will treat it as a formula.
Exercise
While typing a formula in C2, you press the Right Arrow key to move the text cursor, but Excel inserts a cell reference instead. What do you do to move the cursor within the formula text?
Show answer
Press F2 to switch from Point mode to Edit mode, then the arrow keys move the text cursor.