Sub topic 2
Your First Formula: Starting with =
This chapter shows how to enter a formula, what Excel does when you press Enter, and where to read the formula afterward. It assumes you can open a workbook, select a cell, and type a value into it. It also assumes you know basic arithmetic.
Formula or text: the equals sign decides
Excel treats whatever you type into a cell as one of two things. If the entry starts with =, Excel reads it as a formula and calculates it. Otherwise Excel stores it as a number or as text.
Try this in cell A1. Type 8+5 and press Enter. The cell shows 8+5 because Excel stored it as text. Now select A1 again, type the following, and press Enter:
=8+5The cell now shows 13. The leading = told Excel to calculate instead of store.
A formula has two parts:
- The equals sign, which starts the formula.
- The expression after it, which is made of values, operators, and later cell references.
What the cell shows and what it holds
After you press Enter on =8+5, the cell displays the result, 13. The formula is still there. Select the cell and look at the formula bar, the wide box above the column letters. It shows =8+5.
So a formula cell has two views:
| View | Where | Shows |
|---|---|---|
| Displayed value | The cell itself | The result, `13` |
| Stored content | The formula bar | The formula, `=8+5` |
Use the formula bar whenever you want to know how a number was produced. A typed 13 and a calculated 13 look identical in the cell. Only the formula bar tells them apart.
The entry cycle
Entering a formula follows the same steps every time.
While you type, you are in Enter mode. Excel shows your characters in both the cell and the formula bar, but it has not calculated anything yet. Pressing Enter commits the entry. By default, the selection then moves down one cell, which is convenient when you are entering a column of formulas. Pressing Tab also commits, and it moves the selection right. Pressing Escape throws the entry away and restores the previous content.
Try the four basic operators
Each operator is covered in the next chapter. For now, enter these one at a time in separate cells so you see the pattern. The same rule applies to every formula: = first, then the expression.
=20-6This returns 14.
=6*7This returns 42. Excel uses * for multiplication, not x.
=100/4This returns 25. Excel uses / for division, not ÷.
Spaces are allowed and ignored. =100 / 4 gives the same result as =100/4. Most people leave them out for short formulas.
A formula can also use the value in another cell. If B2 holds 12 and C2 holds 3, this formula returns 36:
=B2*C2If you later change B2 or C2, the result updates by itself. That is the main reason to use formulas over typed answers. The chapter on cell references covers it in detail.
Editing a formula you already entered
You do not need to retype a formula to fix it. You have three options:
- Double-click the cell to edit inside it.
- Select the cell and press F2, which puts the cursor at the end of the formula inside the cell.
- Select the cell and click in the formula bar.
Make your change, then press Enter to commit it or Escape to cancel. Selecting a formula cell and typing replaces the whole formula, so edit first if you only want to adjust part of it.
Common first-formula problems
Most beginner problems come from a handful of causes.
- The cell shows your formula instead of a result. You probably left out the
=. A cell formatted as Text, or an entry that begins with an apostrophe, will also display the formula as plain text. Change the format to General, then edit the cell and press Enter again. - The cell shows
#NAME?. Excel could not recognize something you typed. For example,=6x7uses a letter where*belongs. - The result looks wrong. Check the formula bar for a typo, such as
=100/40instead of=100/4. - Nothing happens when you press Enter. Make sure you are not still typing a different entry or have a dialog box open.
Practice
Exercise
In A1 you type =15-9 and press Enter. What do you see in the cell, and what do you see in the formula bar when A1 is selected?
Show answer
The cell shows the result, 6. The formula bar shows the formula, =15-9.
Exercise
You type 12*3 (no equals sign) into a cell and press Enter. What appears, and how do you fix it?
Show answer
The cell shows the text 123, because Excel did not see a formula. Select the cell, press F2, add = at the start so it reads =123, and press Enter. The cell then shows 36.